当前位置: 动力学知识库 > 问答 > 编程问答 >

php - user_timeline twitter API problem

问题描述:

I'm using http://apiwiki.twitter.com/Twitter-REST-API-Method:-statuses-user_timeline to read the tweets of the user. When I used basic auth, it worked fine. When I switched to OAuth, the 'page' parameter stopped working.

Like so:

http://api.twitter.com/1/statuses/user_timeline/16.xml?count=25&page=2

When I use OAuth to fetch the request, it always returns the first page. I check my code. I even echoed the exact same line, and it was exactly what I needed. The XML is exactly what I want, but when I use OAuth to fetch the XML, it returns the wrong XML.

I use abraham's php library.

So basically. The XML is correct and when entered as URL it returns the correct XML, but when trying to fetch it through OAuth, it returns the wrong XML.

Any clue?

网友答案:

In the latest version of my library (currently 0.2.0-beta2) it should be called like this:

$to->format = 'xml';
$content = $to->get('statuses/user_timeline/16', array('count' => 25, 'page' => 2));
网友答案:

I just encountered the same problem - when i am using oauth, Twitter seems to be oblivious about GET parameters. I am using php lib form here: http://abrah.am

this doesnt work:

$url =
"http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=$name&count=199&page=1";
$content = $to->OAuthRequest($url); 

but this does:

$url = "http://api.twitter.com/1/statuses/user_timeline.rss";
$content = $to->OAuthRequest($url, array('screen_name' => $name,'count' => 199, 'page' =>1), 'GET');
分享给朋友:
您可能感兴趣的文章:
随机阅读: