我無法使用CURL進行API調用。下面是如何使用cURLCURL給出500內部服務器錯誤
$ch=curl_init("http://sms.geekapplications.com/api/balance.php?authkey=2011AQTvWQjrcB56d9b03d&type=4");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER,
array("Authorization: Bearer"));
// execute the api call
$result = curl_exec($ch);
echo ($result);
請打印curl_error($ ch);並告訴它返回什麼 –
它沒有顯示任何信息,但當我評論第一行$ ch = curl_init(「http://sms.geekapplications.com/api/balance.php?authkey=2011AQTvWQjrcB56d9b03d&type=4」);一切工作正常,如果我打印任何消息。 – Himanshu
如果這是您的真實身份驗證密鑰,則可能需要在將它發佈到Internet上後進行更改。 –