PHP短信接口开发 成都短信接口 PHP案例

浏览:1698 发布日期:2016/06/15 分类:用法示例 关键字: 短信接口 接口开发 PHP短信接口
PHP短信接口开发 成都短信接口 PHP案例。
sms.php<?php
if(!empty($_GET['sms'])){
$num = $_GET['num'];
$message = $_GET['message'];
set_phone($num,$message);
}

function set_phone($num,$message){
//header("Content-type: text/html; charset=utf-8");
date_default_timezone_set('PRC'); //设置默认时区为北京时间
//短信接口用户名 $uid
$uid = '';
//短信接口密码 $passwd
$passwd = '';
        
        //$num ='136087976876';
        
$msg = rawurlencode(mb_convert_encoding($message, "gb2312", "utf-8"));
$gateway = "http://mb345.com:999/ws/Send.aspx?CorpID={$uid}&Pwd={$passwd}&Mobile={$num}&Content={$msg}&Cell=&SendTime=";

$result = file_get_contents($gateway);
 
if(  $result >= 0 )
{
                echo $gateway;
                echo $result;
echo "发送成功! 发送时间".date("Y-m-d H:i:s");
}
else
{
echo "发送失败, 错误提示代码: ".$result;
}
exit;
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>

<center>
<form action="./sms.php" method="get">手机号码:
<input type="text" name="num" /><br /> <br />短信内容:
<input type="text" name="message" /><br />
<input type="submit" name="sms" value="提交" /><br />


</form>
</center>
</body>
</html>


评论( 相关
后面还有条评论,点击查看>>