0
我试图使用BulkSMS API从我的PHP网站发送短信到手机。我使用下面的代码,但我不知道哪里出了问题。我没有收到短信,没有任何内容显示在浏览器中,只是一个空白页面。使用BulkSMS.com发送短信
<?php
$url = 'http://bulksms.vsms.net/eapi/submission/send_sms/2/2.0';
$to=some number;
$username = 'usernme';
$password = 'password';
$sender='BBMS';
$msisdn = '+968'.$to;
$content="Test";
function do_post_request($url, $data, $optional_headers = 'Content-type:application/x-www-form-urlencoded'){
$params = array('http' => array(
'method' => 'POST',
'content' => $data
));
if ($optional_headers !== null) {
$params['http']['header'] = $optional_headers;
}
$ctx = stream_context_create($params);
$fp = @fopen($url, 'rb', false, $ctx);
if (!$fp) {
throw new Exception("Problem with $url, $php_errormsg");
}
$response = @stream_get_contents($fp);
if ($response === false) {
throw new Exception("Problem reading data from $url, $php_errormsg");
}
return $response;
var_dump($response);
}
?>
请提供一些附加信息,如从服务器返回的错误日志或异常 – nKognito
实际上没有任何内容仅显示空白页...我将xampp用作服务器 – Arwa
您的'do_post_request'函数是否被调用? – devqon