curl 命令在服务器上不工作……还有其他选择吗?

curl command not working on server.... any alternate of this?

<?php
if(isset($_POST["submit"]))
{
$adm=$_POST["admno"];
$phn=$_POST["phn1"];
include("model.php");
$db = new database;
$r=$db->register($adm);
while($row=mysql_fetch_array($r))
{

if($row["phn_no1"]==$phn  || $row["phn_no2"]==$phn  ||   $row["phn_no3"]==$phn)
{
    $formatted = "".substr($phn,6,10)." ";
    $password = $formatted + $adm;
    echo $password;
    $db->setpassword($adm,$password);
    $pre = 'PREFIX';
    $suf = '%20ThankYou';
    $sms = $pre.$password.$suf;
    session_start();



     $ch = curl_init("http://www.perfectbulksms.in/Sendsmsapi.aspx? USERID=ID&PASSWORD=PASS&SENDERID=SID&TO=$phn&MESSAGE=$sms");
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_AUTOREFERER, true);
    $result = curl_exec($ch);
      curl_close($ch);
     header("Location:password.php?msg=new"); 

    }
else
{
    header("Location:register.php?msg=invalid");

}
}
}
?>

这段代码在我的本地主机上运行完美..但是当我把它放在服务器上时...需要很多时间但是 curl 命令中的代码不起作用它只引用下一页...我检查是否启用了 curl .. 如果我只使用没有 curl 命令的短信 api 它会立即发送短信.... 但我想 运行 都 header 并且还想隐藏我的短信api.. 有替代品吗???

检查从服务器到 SMS 的简单 wget 或 curl API 是否工作正常?

bash~/$wget "http://www.perfectbulksms.in/Sendsmsapi.aspx?USERID=ID&PASSWORD=PASS&SENDERID=SID&TO=$phn&MESSAGE=$sms"

bash~/$curl "http://www.perfectbulksms.in/Sendsmsapi.aspx?USERID=ID&PASSWORD=PASS&SENDERID=SID&TO=$phn&MESSAGE=$sms"

如果 wget 或 curl 没问题,那么你的代码有问题。

如果 wget 或 curl 无法从服务器运行,则可能是端口 80 被您的 ISP 阻止了传出流量。请与 ISP 确认。

你也可以试试

远程登录 www.perfectbulksms.in 80

看看是否连接上了。