问题描述
我写了一个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 (将#修改为@)