免费试用
PHP网站短信接口函数示例
短信平台首页 >短信营销方案

PHP网站短信接口函数示例

时间:2011-02-14 来源:九天企信王 作者:过竹雨

php调用sms9短信接口的函数:

function sendsms($mobile,$content)
{
 $user_id = ''; // sms9平台用户id
 $pass = ''; // 用户密码
 $channelid = ''; // 发送频道id
 
 if(!$mobile || !$content || !$user_id || !$pass || !$channelid) return false;
 
 if(is_array($mobile)) $mobile = implode(",",$mobile);
 
 /*  utf8需要转码
 $content = iconv("utf-8","gbk//ignore",$content);
 **/
 $content = urlencode($content);
 
 $api = "//admin.sms9.net/houtai/sms.php?cpid={$user_id}&password={$pass}&channelid={$channelid}&tele={$mobile}&msg={$content}";
 $res = file_get_contents($api);
 return strpos($res,'success') === false ? $res : true;
}
使用方法:sendsms("手机号码","发送内容"); 多个手机号码可以用,连接,或者传入数组。

相关文章

热点排行

版权所有:北京九天揽月科技有限公司 www.sms9.net
九天企信王- 短信群发 电话:010-82028588
增值电信许可证编号:京B2-20060060 联系我们