0
我打電話給一個站點獲取訪問令牌。這是響應如何使用php獲取實際的令牌。進程休息響應php
HTTP/1.1 200 OK Date: Sat, 16 Dec 2017 16:54:20 GMT
Content-Type: application/json;
charset=UTF-8
Content-Length: 113
Connection: keep-alive
Cache-Control: no-store
Server: Apigee Router { "access_token": "1NQA27eHVzHC6idx2f7JDbJiD4CQ", "expires_in": "3599" }
以下代碼失敗。
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Authorization: Basic '.$credentials)); //setting a custom header
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$curl_response = curl_exec($curl);
$token = $curl_response['access_token'];
echo "<br/>";
echo $token;
你得到了什麼錯誤? –
https://stackoverflow.com/a/1234556/3548935 –