首頁 > 後端開發 > php教程 > 关于php 发送短信到手机的有关问题

关于php 发送短信到手机的有关问题

WBOY
發布: 2016-06-13 10:51:24
原創
875 人瀏覽過

关于php 发送短信到手机的问题!
在 DEDE 里搞两个程序要发送短信通知用户,

发送函数这样的:

function sendmb( $mobile, $c, $name, $pwd )
{
$URL = "http://218.241.153.202:8888/post_sms.do";
$post_data['corp_id'] = "309090";
$post_data['user_id'] = $name ;
$pwd .= "td";
$pwd = md5( $pwd );
$post_data['MD5_td_code'] = $pwd ;
$post_data['mobile'] = $mobile ;
$post_data['msg_content'] = $c ;
$post_data['mesg_id'] = "";
$post_data['extend'] = "";
$URL_Info = parse_url( $URL );
foreach ( $post_data as $key => $value )
{
$values[] = "{$key}=".urlencode( $value );
}
$data_string = implode( "&", $values );
$URL_Info['port'] = 8888;
$request .= "POST ".$URL_Info['path']." HTTP/1.1\n";
$request .= "Host: ".$URL_Info['host']."\n";
$request .= "Referer: ".$referrer."\n";
$request .= "Content-type: application/x-www-form-urlencoded\n";
$request .= "Content-length: ".strlen( $data_string )."\n";
$request .= "Connection: close\n";
$request .= "\n";
$request .= $data_string."\n";
$fp = fsockopen( $URL_Info['host'], $URL_Info['port'] );
fputs( $fp, $request );
while ( !feof( $fp ) )
{
$result .= fgets( $fp, 1024 );
}
fclose( $fp );
$ret = explode( "close", $result );
return trim( $ret[1] );
}

调用:(号码我就不公开了哈...免得天天全国打过来挨骂)


sendmb("13#10101###","fuck ass","baby","abc123");



可是运行后没反应,请问怎么解决?

------解决方案--------------------
以前做过支付交易,登录投诉时候用过。对页面编码也是有要求的,你仔细看下,

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板