2017-06-29 76 views
0

$ url ='http://103.xx.xxx.xx:8085/MessagingGateway/SendTransSMS?Username='。$ smsUserName。' & Password ='。$ smsUserPass。' & MessageType = txt & Mobile ='。$ mobile。' & SenderID ='。$ senderID。' & Message ='。$ message;Curl请求失败错误“无法连接到103.xx.xxx.xx端口8085:连接被拒绝”

$ch = curl_init(); 
    curl_setopt($ch, CURLOPT_URL, $url); 
    curl_setopt($ch, CURLOPT_HEADER, 0); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);  
    $result = curl_exec($ch); 
    $error = curl_error($ch); 
    curl_close($ch); 

    return response()->json(['status'=>'success', 'msg'=>$result, 'url' =>$url]); 

相同的代码在localhost xampp服务器上工作,但它不工作godaddy共享主机。

错误显示:“无法连接到103.xx.xxx.xx端口8085:连接被拒绝”。请告诉我我做错了什么?

+0

您要求curl连接到没有任何内容正在侦听的IP地址和TCP端口... –

回答

0

检查是否卷曲启用 或者您也可以从php.ini文件中启用它

如果您共享主机,则可能需要托管服务提供商打电话。

+0

curl在服务器上启用。 cURL支持\t已启用 cURL信息\t 7.36.0 年龄\t 3 –

0

如果您可以尝试从https启用的域/主机执行相同的请求,它可能有助于排查问题。另外,这可能与服务器的防火墙阻止请求有关。

相关问题