如果我直接轉到具有URL中正確參數的URL,我會收到成功響應。將PHP發佈到API(使用cURL嘗試)
的URL看起來像
https://api.theService.com/send?client_id=54&token=7545h5h554&format=json
在PHP中,我想是這樣
error_reporting(E_ALL);
ini_set('display_errors', 1);
$client_id = 54;
$token = '7545h5h554';
$ch = curl_init('https://api.theService.com/send?client_id='.$client_id.'&token='.$token.'&format=json');
// Send the request
$response = curl_exec($ch);
// Check for errors
if($response === FALSE){
die(curl_error($ch));
}
// Decode the response
$responseData = json_decode($response, TRUE);
echo "<pre>";
echo print_r($responseData);
echo "</pre>";
但是我從來沒有得到與上面的代碼的響應。
您是否收到錯誤消息? –
[PHP CURL&HTTPS]的可能重複(http://stackoverflow.com/questions/4372710/php-curl-https) –
我沒有得到任何錯誤。 –