i got the cURL string using OAuth tool
curl --get ‘https://api.twitter.com/1.1/followers/list.json’ --data ‘cursor=-1&include_user_entities=false&screen_name=sitestreams&skip_status=true’ --header ‘Authorization: OAuth oauth_consumer_key=“XXXXXX”, oauth_nonce=“XXXXXX”, oauth_signature=“XXXXXX”, oauth_signature_method=“HMAC-SHA1”, oauth_timestamp=“XXXXXX”, oauth_token=“XXXXXX”, oauth_version=“1.0”’ --verbose
and my php code is
$url = trim(‘https://api.twitter.com/1.1/followers/list.json’);
$postArr = array(‘cursor’=>’-1’,‘screen_name’=>‘tokalpeshdp’,‘skip_status’=>‘true’,‘include_user_entities’=>‘false’);
$othArr = array(‘Authorization: OAuth oauth_consumer_key=“XXXXX”,oauth_nonce=“XXXXX”,oauth_signature=“XXXXX”, oauth_signature_method=“HMAC-SHA1”,oauth_timestamp=“XXXXX”,oauth_token=“XXXXX”,oauth_version=“1.0”’);
$ch = curl_init($url);
if ($ch === FALSE){
throw new Exception(‘failed to initialize’);
exit;
}
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS,$postArr);
curl_setopt($ch, CURLOPT_HTTPHEADER,$othArr);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT,2000);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
$result = curl_exec($ch);
if(curl_error($ch))
{
echo "Error: >> ".curl_error($ch);
exit;
}
echo "Result: >> ".$result;
AND I GOT FOLLOWING RESULT ¬
{“errors”:[{“message”:“Could not authenticate you”,“code”:32}]}Result: >> 1
so what is the wrong with my code.