Home > Article > Backend Development > 关于php 发送短信到手机的有关问题
关于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");
可是运行后没反应,请问怎么解决?
------解决方案--------------------
以前做过支付交易,登录投诉时候用过。对页面编码也是有要求的,你仔细看下,