如何在php中获取所有twitter关注者的详细信息(而不是关注者数量)?
下面是一段代码,可以很好地获取关注者和关注者的数量。但我想向每个关注者显示所有详细信息(图片、用户名、id等)…实际上我是通过使用$followData=json_decode($instgram->getFollowing(20))方法为instagram做到这一点的; 我为推特做什么如何在php中获取所有twitter关注者的详细信息(而不是关注者数量)?,php,twitter,dreamweaver,Php,Twitter,Dreamweaver,下面是一段代码,可以很好地获取关注者和关注者的数量。但我想向每个关注者显示所有详细信息(图片、用户名、id等)…实际上我是通过使用$followData=json_decode($instgram->getFollowing(20))方法为instagram做到这一点的; 我为推特做什么 <?php require('http.php'); require('oauth_client.php'); $client = new oauth_client_class; $client-&
<?php
require('http.php');
require('oauth_client.php');
$client = new oauth_client_class;
$client->debug = 1;
$client->server = 'Twitter';
$client->redirect_uri = 'http://'.$_SERVER['HTTP_HOST'].
dirname(strtok($_SERVER['REQUEST_URI'],'?')).'/login_with_twitter.php';
$client->client_id = 'my client id'; $application_line = __LINE__;
$client->client_secret = 'my client secret';
if(strlen($client->client_id) == 0
|| strlen($client->client_secret) == 0)
die('Please go to Twitter Apps page https://dev.twitter.com/apps/new , '.
'create an application, and in the line '.$application_line.
' set the client_id to Consumer key and client_secret ... '.
'The Callback URL must be '.$client->redirect_uri);
if(($success = $client->Initialize()))
{
if(($success = $client->Process()))
{
if(strlen($client->access_token))
{
$success = $client->CallAPI(
'https://api.twitter.com/1.1/account/verify_credentials.json',
'GET', array(), array('FailOnAccessError'=>true), $user);
}
}
$success = $client->Finalize($success);
}
if($client->exit)
exit;
if($success)
{
$following =$user->friends_count;
$followers =$user->followers_count;
?>
您可以尝试以下方法:
using (WebClient client = new WebClient())
{
string url = "http://twitter.com/users/show.xml?screen_name=[username]";
string response = client.DownloadString(url);
}
关于您遇到了什么错误?您需要使用oauth。