MultiformeIngegno
MultiformeIngegno

Reputation: 7059

Switching from Twitter API 1 to 1.1 (adding auth)

Currently I use this code to retrieve the latest 6 tweets on my timeline. I read Twitter documentation but I can't understand how to implement the Auth keys of the app I created.

    <?php
    $json = wp_remote_get("http://api.twitter.com/1/statuses/user_timeline/username.json?count=6", true);
    $decode = json_decode($json['body'], true);
    echo "
        <ul style='color:#6E6E6E'>";
        $count = count($decode); //counting the number of status
        for($i=0;$i<$count;$i++){ echo '
        <li>'.$decode[$i]['text'].'<br><a href='; echo '"http://twitter.com/#!/'.$decode[0][user][name].'/status/'.$decode[$i][id].'"><small>'. strftime('%e %B',strtotime($decode[$i]['created_at'])) ."</small></a> - <a href='http://twitter.com/intent/tweet?in_reply_to=".$decode[$i][id]."'><small>rispondi</small></a> - <a href='http://twitter.com/intent/retweet?tweet_id=".$decode[$i][id]."'><small>retweet</small></a> - <a href='http://twitter.com/intent/favorite?tweet_id=".$decode[$i][id]."'><small>preferito</small></a></li>";} echo "
        </ul>
    ";
    ?>

Upvotes: 0

Views: 781

Answers (1)

ronzohan
ronzohan

Reputation: 105

http://ronzohan.blogspot.com/2013/01/how-to-connect-in-twitter-using-php.html, You can try and see the explanation on how the twitter oauth works.

Upvotes: 1

Related Questions