1
當我嘗試使用Twilio REST API發送SMS時,出現以下錯誤。Twilio REST API - 服務器錯誤
HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.
代碼:
require("Services/Twilio.php");
$account_sid = "ACD123456789"; // Your Twilio account sid
$auth_token = "ACD123456789"; // Your Twilio auth token
$client = new Services_Twilio($account_sid, $auth_token);
$message = $client->account->sms_messages->create(
'+1415599XXXX', // From a Twilio number in your account
'+1609531XXXX', // Text any number
"Hello world!"
);
print $message->sid;
嗨,這部分代碼看起來不錯。你能檢查你的文件是以「<?php」開頭的嗎?此外,500服務器錯誤意味着應該有一個日誌文件解釋錯誤的地方 - 看看你是否能找到它並在那裏閱讀消息。 –
啓用錯誤日誌後,我發現我一直在使用的手機號碼未經驗證。謝謝你的幫助。 –