如何解决我该如何克服我的服务器拒绝连接的问题
我写了一个curl代码来运行SMS API。它在本地主机上运行良好。当我将其上传到虚拟主机时,它显示错误,例如 无法连接到smeapps.mobitel.lk端口8585:连接被拒绝 。
我不知道该怎么解决?
这是我写的代码。
<?php
// Your ID and token
//Content-Type: application/json
//Accept: application/json
//header('Content-Type: application/json');
//header('Accept: application/json');
$blogID = 'xxxxxx';
$authToken = 'xxxxx';
// The data to send to the API
$postData = array(
'username' => 'xxxxx','password' => 'xxxx','from' => 'xxxx','to' => '07612xxxxx','text'=>'hello','messageType'=>0
);
// Setup cURL
$ch = curl_init('http://smeapps.mobitel.lk:8585/EnterpriseSMSV3/esmsproxyURL.php');
curl_setopt_array($ch,array(
CURLOPT_POST => TRUE,CURLOPT_RETURNTRANSFER => TRUE,CURLOPT_HTTPHEADER => array(
'Authorization: '.$authToken,'Content-Type: application/json','Accept: application/json'
),CURLOPT_POSTFIELDS => json_encode($postData)
));
// Send the request
$response = curl_exec($ch);
// Check for errors
if($response === FALSE){
die(curl_error($ch));
}
// Decode the response
$responseData = json_decode($response,TRUE);
// Print the date from the response
//echo $responseData['published'];
?>
代码中也提到了链接。有人可以帮我解决吗?
谢谢。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。