Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/256.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在php url中使用API发送SMS未响应_Php_Api_Post_Get_Sms - Fatal编程技术网

在php url中使用API发送SMS未响应

在php url中使用API发送SMS未响应,php,api,post,get,sms,Php,Api,Post,Get,Sms,我可以使用这个php代码从localhost发送短信。但当我将此代码上传到服务器时,我无法从url获得响应 $data ='username=' .$username . '&api_password=' . $hash . '&sender=' . $sender . "&to=" . $numbers . "&message=" . $message . "&priority=11" ; // Send the GET request with c

我可以使用这个php代码从localhost发送短信。但当我将此代码上传到服务器时,我无法从url获得响应

$data ='username=' .$username . '&api_password=' . $hash . '&sender=' . $sender . "&to=" . $numbers . "&message=" . $message . "&priority=11" ;


// Send the GET request with cURL
$ch = curl_init('http://****************' . $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

// Process your response here
echo $response;
我也试过这个方法。我可以从本地主机发送短信。但当我上传到我的实时服务器上时没有响应。在php中还有其他发送短信的方法吗?
请帮忙

错误是什么?服务器上是否安装了curl请参阅访问和错误日志检查
http\u code
。在SMS系统中,他们发送成功、失败或反弹等http_代码。@M A SIDDIQUI没有显示错误。url没有响应。如何在服务器上安装curl?在您的live服务器上使用的是什么php版本?@Akin php version 5.4
$data = array('username' => $username, 'api_password' => $hash, "sender" => $sender, 'to' => $numbers, "message" => $message, "priority" => 11);


// Send the POST request with cURL
$ch = curl_init('http://**********************');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);

// Process your response here
echo $response;