Php 在textlocal上检查已发送文本消息的状态
我正在使用文本本地(textlocal.com)使用PHP发送文本消息,以下是我必须发送消息的代码:Php 在textlocal上检查已发送文本消息的状态,php,Php,我正在使用文本本地(textlocal.com)使用PHP发送文本消息,以下是我必须发送消息的代码: // Send the POST request with cURL $ch = curl_init('https://www.txtlocal.com/sendsmspost.php'); //note https for SSL curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
// Send the POST request with cURL
$ch = curl_init('https://www.txtlocal.com/sendsmspost.php'); //note https for SSL
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch); //This is the result from Textlocal
curl_close($ch);
如何检查它是否失败?试试看
$resultStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($resultStatus != 200) {
die('Request failed: HTTP status code: ' . $resultStatus);
}
或
提及
var_dump($result );