這工作在bash直接罰款:PHP捲曲的REST API不工作
curl https://test.url.com/api/id/98765 -H 'API_KEY: xxxxxxxxxx' -H 'Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=='
這並不在PHP中工作(不返回任何):返回
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL,'https://test.url.com/api/id/98765');
curl_setopt($curl, CURLOPT_HEADER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
"API_KEY: xxxxxxxxxx8",
"Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=="
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl, CURLOPT_VERBOSE, 1);
$results = curl_exec($curl);
echo 'out: '.$results;
沒有錯誤。我期待的結果JSON
@ user2029890你的錯誤報告是否爲ON? –
是的,錯誤報告已打開。我通過故意創建了一個語法錯誤 – user2029890
Blat!沒關係,現在我看到你在CURL中工作。 \ *深入挖掘\ * – brandonscript