日期:2014-05-17 浏览次数:20495 次
function smsto($telphone,$message) { //短信接口用户名 $uid,如果没有或不能发送请与客服QQ:272927682联系 $uid = 'qxt01'; //短信接口密码 $passwd $passwd = '123456'; //发送到的目标手机号码 $telphone //$telphone = '13845689748';//此处改成自己的手机号 //短信内容 $message //$message = "这是一条测试信息"; $message1 =urlencode(mb_convert_encoding($message, 'utf-8', 'gb2312')); $gateway = "http://sms.zgqxt.com/msgsend.ashx?USERNAME={$uid}&PASSWORD={$passwd}&MOBILE={$telphone}&CONTENT={$message1}&SEQ=1000"; $result = file_get_contents($gateway); return $result; }
$SendMember = $_POST["SendMember"]; //说明:取用户输入的手号,也可以自己指定手机号 $SendMSG = $_POST["SendMSG"];//说明:取用户输入的短信内容,也可以自己指定内容 $smsok=smsto($SendMember,$SendMSG);
<?php $cont="你好,这是我发的测试短信,祝你成功!"; $mynum="手机号码"; $url='http://gateway.woxp.cn:6630/gb2312/web_api/?x_eid=0&x_uid=会员账号&x_pwd_md5=MD5加密后的密码&x_ac=10&x_target_no='."$mynum".'&x_memo='."$cont".'&x_gate_id=300'; echo Get($url); function Get($url){ if(function_exists('file_get_contents')){ $file_contents = file_get_contents($url); }else{ $ch = curl_init(); $timeout = 5; curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $file_contents = curl_exec($ch); curl_close($ch); } return $file_contents; } ?>