0
這裏是代碼,它可以很好地得到追隨者的數量和跟隨。但我想顯示每個追隨者的所有細節(圖片,用戶名,ID等)..實際上,我通過使用方法$ instagramdata = json_decode($ instgram-> getFollowing(20)); 我爲推特做什麼。如何在PHP中獲取所有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;
?>
你得到什麼錯誤? – Morvader
你需要使用oauth。 – Vishal