Quantcast
Channel: みついれ@うぇぶろぐ » twitter
Viewing all articles
Browse latest Browse all 3

EasyBotterを使ったBotが停止していたのを復活

0
0

botが停止して何事かとおもいきやAPIの仕様変更だったのですね…

bot.phpを叩いて

object(SimpleXMLElement)#10 (1) {
["error"]=>
string(31) "Sorry, that page does not exist"
}

がでてきたので検索したら発覚

以下EasyBotter 非公式wiki – 最新のAPIに変更 – @ウィキモバイルを参照に直しました。
スクリプトで変更しようと思ったら上手く行かなかったのでEasyBotter.php の下部にまとまっている API 群のURLを手動で書き換えますた

https://twitter.com/statuses/update.xml

http://api.twitter.com/1/statuses/update.xml

http://twitter.com/statuses/friends_timeline.xml

http://api.twitter.com/1/statuses/friends_timeline.xml

http://twitter.com/statuses/replies.xml

http://api.twitter.com/1/statuses/mentions.xml

http://twitter.com/statuses/friends.xml

http://api.twitter.com/1/statuses/friends.xml

http://twitter.com/statuses/followers.xml

http://api.twitter.com/1/statuses/followers.xml

http://twitter.com/friendships/create/”.$screen_name.”.xml

http://api.twitter.com/1/friendships/create/”.$screen_name.”.xml

もう一回bot.phpを叩いて再起動確認
よかったよかった(*´∀`)!
Easybotter.phpの下部の変更後phpも載せときますのでまるっとコピペでok

    //基本的なAPIを叩く
    function _setData($url, $value = array()){
        $response = $this->consumer->sendRequest($url, $value, "POST");
        $response = simplexml_load_string($response->getBody());
        return $response;
    }
    function _getData($url){
        $response = $this->consumer->sendRequest($url,array(),"GET");
        $response = simplexml_load_string($response->getBody());
        return $response;
    }
    function setUpdate($value){
        $url = "http://api.twitter.com/1/statuses/update.xml";
        return $this->_setData($url,$value);
    }
    function getFriendsTimeline(){
        $url = "http://api.twitter.com/1/statuses/friends_timeline.xml";
        return $this->_getData($url);
    }
    function getReplies($page = false)
    {
        $url = "http://api.twitter.com/1/statuses/mentions.xml";
        if ($page) {
            $url .= '?page=' . intval($page);
        }
        return $this->_getData($url);
    }
    function getFriends($id = null)
    {
        $url = "http://api.twitter.com/1/statuses/friends.xml";
        return $this->_getData($url);
    }
    function getFollowers()
    {
        $url = "http://api.twitter.com/1/statuses/followers.xml";
        return $this->_getData($url);
    }
    function followUser($screen_name)
    {
        $url = "http://api.twitter.com/1/friendships/create/".$screen_name.".xml";
        return $this->_setData($url);
    }
}
?>

外部リンク

EasyBotter 非公式wiki – 最新のAPIに変更 – @ウィキモバイル


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images