我花了过去几个小时的时间,试图改变所有类型的差异,但据Twitter AP说,这本来应该从第1步开始。
1 addition I have made to the script below is that I have added in: $header = array("Expect:");
在另一个问题中,我发现,从获得一个否认的问题到第100-continue的问题,这个问题有所帮助。
Issue: Failed to validate oauth signature and token is the response EVERY time!!!
我的员额数据实例:
Array ( [oauth_callback] => http://www.mysite.com//index.php [oauth_consumer_key] => hidden [oauth_nonce] => hidden [oauth_signature_method] => HMAC-SHA1 [oauth_timestamp] => 1301270847 [oauth_version] => 1.0 )
我的主人数据:
Array ( [0] => Expect: )
原文:
$consumer_key = "hidden";
$consumer_secret = "hidden";
function Post_Data($url,$data,$header){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
$data[ oauth_callback ] = "http://".$_SERVER[ HTTP_HOST ].$_SERVER[ PHP_SELF ];
$data[ oauth_consumer_key ] = $consumer_key;
$data[ oauth_nonce ] = md5(time());
$data[ oauth_signature_method ] = "HMAC-SHA1";
$data[ oauth_timestamp ] = time();
$data[ oauth_version ] = "1.0";
$header = array("Expect:");
$content = Post_Data("http://api.twitter.com/oauth/request_token",$data,$header);
print_r($content);
没有人会看到我在这里可能犯下的明显错误? 最好是我不赞同其他人的守则,因为大多数例子都有完全的班级和整顿;我正在寻找最简单的办法!