1
我正在使用twitter數字。我的移動驗證工作正常。但與AUTH標題信息當我打電話捲曲那麼它不working.my捲曲代碼,來形成$ _REQUESTTwitter數字API不工作CURL php
$request=$_REQUEST['someData'];
function oauth_value($headersIndex = [])
{
if(empty($headersIndex)) return 'Invalid Index Number';
$value = explode('=', $headersIndex);
return str_replace('"', '', $value[1]);
}
$headersData = explode(',',$request['headers']);
$ch = curl_init();
$ch = curl_init($request['apiUrl']);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization' => 'OAuth oauth_consumer_key="'.oauth_value($headersData[0]).'",
oauth_nonce="'.oauth_value($headersData[1]).'",
oauth_signature="'.oauth_value($headersData[2]).'",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="'.oauth_value($headersData[4]).'",
oauth_token="'.oauth_value($headersData[5]).'",
oauth_version="'.oauth_value($headersData[6]).'"'
)
);
$resp = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
例如信息[「someData」];
Array
(
[apiUrl] => https://api.digits.com/1.1/sdk/account.json
[headers] =>
OAuth oauth_consumer_key="OybCXYoYTuS0Cw0usZYry6Nlj",
oauth_nonce="3942830480-TILitVHHZGmcczuuFj3nbJtnMm00DHvvgduawMHOybCXYoYTuS0Cw0usZYry6Nlj1445246231940",
oauth_signature="dXHcH%2FsLBIlYOVWBIhEBWSCMLJo%3D",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="1445246231",
oauth_token="3942830480-TILitVHHZGmcczuuFj3nbJtnMm00DHvvgduawMH",
oauth_version="1.0"
)
現在能做什麼?