【发布时间】:2013-06-19 06:39:59
【问题描述】:
https://api.twitter.com/1.1/users/show.json?screen_name=screen-name&include_entities=true
不工作。
Getting Bad Authentication 数据错误。
Twitter 集成也遇到了同样的错误。如何解决这个错误?
【问题讨论】:
https://api.twitter.com/1.1/users/show.json?screen_name=screen-name&include_entities=true
不工作。
Getting Bad Authentication 数据错误。
Twitter 集成也遇到了同样的错误。如何解决这个错误?
【问题讨论】:
您需要使用 oAuth。
例如使用这个类 - https://github.com/abraham/twitteroauth 还必须创建应用程序来获取所需的密钥($consumer_key、$consumer_secret、$oauth_token、$oauth_token_secret)。 并从时间轴获取例如推文,只需执行此代码
require_once(dirname(__FILE__) . '/libs/twitteroauth.php');
$connection = new TwitterOAuth($consumer_key, $consumer_secret, $oauth_token, $oauth_token_secret);
$response = $connection->get('statuses/user_timeline', array('screen_name' => $twitter_name));
echo '<pre>'.print_r($response,1).'</pre>';
【讨论】: