dongziya9863 2014-03-28 10:35
浏览 63

如何在php中获取twitter(不是粉丝数)的所有追随者的详细信息?

Here is code which works fine to get count of followers and following .but i want to show every follower all details (pic,username,id etc)..actually i did this for instagram by using method $followingdata = json_decode($instgram->getFollowing(20)); what i do for twitter.

<?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;
?>
  • 写回答

1条回答 默认 最新

  • douyun3631 2014-03-28 12:00
    关注

    You could try something like:

            using (WebClient client = new WebClient())
            {
                string url = "http://twitter.com/users/show.xml?screen_name=[username]";
    
                string response = client.DownloadString(url);
            }
    

    Regards

    评论

报告相同问题?

悬赏问题

  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100