我的问题是,我正在使用-$url = http://sms.emefocus.com/sendsms.jsp?user="$uname"&password="$pwd"&mobiles="$mobiil_no"&sms="$msg"&senderid="$sender_id"; $ret = file($url);
-url从用户面板向用户发送短信,并且我正在使用FILE操作来执行这个url,如上所述。
在我尝试打印$ret时执行此操作后,它会给我状态true,并生成消息id和发送id。
但它没有交付给用户。。。。??当我在浏览器中执行与$url = http://sms.emefocus.com/sendsms.jsp?user="$uname"&password="$pwd"&mobiles=98xxxxxx02&sms=Hi..&senderid="$sender_id"
相同的url时它会立即送达。。??
有人能帮我吗。。??提前谢谢。。
这项短信服务可能需要考虑是浏览器而不是机器人在执行请求,或者有一些我们不知道的"保护"。有关于这项特殊服务的任何文件吗?它是否打算像你想做的那样使用?
你可以尝试使用CURL,看看行为是否仍然相同:
<?php
// create curl resource
$ch = curl_init();
$agent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)';
// set url
curl_setopt($ch, CURLOPT_URL, "example.com");
// Fake real browser
curl_setopt($curl, CURLOPT_USERAGENT, $agent);
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $output contains the output string
$ret = curl_exec($ch);
// close curl resource to free up system resources
curl_close($ch);
?>
它有帮助吗?