更新:代码现在可以使用
所以,我正在使用Abraham's Twitter Oauth Library for PHP,我下载文件并开始修改它(输入消费者密钥和消费者秘密)
我也把这个网址改为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] => ) )
任何人都知道发生了什么? 提前致谢