请在下面查看我的代码。基本上它可以工作,我会检索我需要的东西,但只需要很短的时间,然后它就会停止工作。我希望使用返回的数据来创建 Twitter 提要。这不能是这样吗?
$oauth_consumer_key = '-------------------';
$oauth_consumer_key_secret = '-------------------';
$oauth_token = '-------------------';
$oauth_token_secret = '-------------------';
$oauth_nonce = '-------------------';
$oauth_signature = '-------------------';
$oauth_timestamp = time();
$oauth_hash = '';
$oauth_hash .= 'oauth_consumer_key=9bSWNyMCJ2Pu5VOibPU13A&';
$oauth_hash .= 'oauth_nonce='.$oauth_nonce.'&';
$oauth_hash .= 'oauth_signature_method=HMAC-SHA1&';
$oauth_hash .= 'oauth_timestamp='.$oauth_timestamp.'&';
$oauth_hash .= 'oauth_token=559439614-4cmIUCxb9FfUBsNTmeHZrox2FRpVQbvuED508lQm&';
$oauth_hash .= 'oauth_version=1.0';
$base = '';
$base .= 'GET';
$base .= '&';
$base .= rawurlencode('https://api.twitter.com/1.1/favorites/list.json');
$base .= '&';
$base .= rawurlencode($oauth_hash);
$key = '';
$key .= rawurlencode('tF3CtuDtPGh8OYPBw7ZRs8Mrrj8kjmZRS0Q5jeA1vw'); // Consumer Secret
$key .= '&';
$key .= rawurlencode('FDji1JuBeCNcQzjADjQdN3sOmk7xlAV3ILuooWCuYI'); // Access Token Secret
$signature = base64_encode(hash_hmac('sha1', $base, $key, true));
$signature = rawurlencode($signature);
// Construct cURL Headers...
$oauth_header = '';
$oauth_header .= 'oauth_consumer_key="'.$oauth_consumer_key.'", ';
$oauth_header .= 'oauth_nonce="'.$oauth_nonce.'", ';
$oauth_header .= 'oauth_signature="'.$oauth_signature.'", ';
$oauth_header .= 'oauth_signature_method="HMAC-SHA1", ';
$oauth_header .= 'oauth_timestamp="'.$oauth_timestamp.'", ';
$oauth_header .= 'oauth_token="'.$oauth_token.'", ';
$oauth_header .= 'oauth_version="1.0", ';
$curl_header = array("Authorization: Oauth {$oauth_header}", 'Expect:');
// Make the cURL Request...
$curl_request = curl_init();
curl_setopt($curl_request, CURLOPT_HTTPHEADER, $curl_header);
curl_setopt($curl_request, CURLOPT_HEADER, false);
curl_setopt($curl_request, CURLOPT_URL, 'https://api.twitter.com/1.1/favorites/list.json');
curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, false);
$json = curl_exec($curl_request);
curl_close($curl_request);
$json = json_decode($json, true);