更新:代码现在可以使用
所以,我正在使用Abraham 的 Twitter Oauth Library for PHP,我下载文件并开始修改它(输入消费者密钥和消费者密码)
我也将 url 更改为 twitter API 1.1 的链接:$connection->host = "https://api.twitter.com/1.1/";
但是当我打开页面时,它告诉我:Could not connect to Twitter. Refresh the page or try again later.
然后我print_r
得到$connection
了这个:
TwitterOAuth Object ( [http_code] => 0 [url] => XXX&oauth_consumer_key=XXX&oauth_nonce=XXX&oauth_signature=XXX&oauth_signature_method=HMAC-SHA1&oauth_timestamp=XXX&oauth_version=1.0 [host] => https://api.twitter.com/1.1/ [timeout] => 30 [connecttimeout] => 30 [ssl_verifypeer] => [format] => json [decode_json] => 1 [http_info] => Array ( [url] => XXX&oauth_consumer_key=XXX&oauth_nonce=XXX&oauth_signature=XXX&oauth_signature_method=HMAC-SHA1&oauth_timestamp=XXX&oauth_version=1.0 [content_type] => [http_code] => 0 [header_size] => 0 [request_size] => 0 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0 [namelookup_time] => 0.014468 [connect_time] => 0 [pretransfer_time] => 0 [size_upload] => 0 [size_download] => 0 [speed_download] => 0 [speed_upload] => 0 [download_content_length] => -1 [upload_content_length] => -1 [starttransfer_time] => 0 [redirect_time] => 0 [certinfo] => Array ( ) [redirect_url] => ) [useragent] => TwitterOAuth v0.2.0-beta2 [sha1_method] => OAuthSignatureMethod_HMAC_SHA1 Object ( ) [consumer] => OAuthConsumer Object ( [key] => XXX[secret] => XXX[callback_url] => ) [token] => OAuthConsumer Object ( [key] => [secret] => [callback_url] => ) )
有谁知道发生了什么?提前致谢