$url = 'http://yoursmsgateway.com/WebSMS/SMSAPI.jsp?username='.$smsuser.'&password='.$smspwd.'&sendername='.$smssender.'&mobileno='.$number.'&message='.urlencode($message);
echo $url;
$mystring = get_data($url);
//echo "hi!";
echo $mystring;
function get_data($url) {
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
你可以试试这个代码,但你必须安装 cUrl DLL 文件。安装 CURL 的过程如下:-
1.)打开 php.ini 文件
2.)找到这个dll文件---> ;extension=php_curl.dll
3.)删除;(分号)
4.)如---> extension=php_curl.dll
5.) 保存 (Ctrl+s)