当前位置:Gxlcms > PHP教程 > GoogleVoice短信发送接口PHP开源版(2010.5更新)_php实例

GoogleVoice短信发送接口PHP开源版(2010.5更新)_php实例

时间:2021-07-01 10:21:17 帮助过:5人阅读

1,支持群发
2,中文转成拼音发送
如果需要群发多帐号用英文逗号(,)分隔(86159..,86159..),消息内容不支持中文,当您输入中文的时候系统会自动转换为拼音(为了区分是拼音,拼音首字母大写),保证消息能正常发送(输入”我是旋风”短信内容为”Wo Shi Xuan Feng”).
代码如下:
  1. <br><!--?php <BR-->/* <br>提示:如果需要群发多帐号用英文逗号(,)分隔(86159..,86159..),消息内容不支持中文, <br>当您输入中文的时候系统会自动转换为拼音(为了区分是拼音,拼音首字母大写), <br>保证消息能正常发送(输入"我是旋风"短信内容为"Wo Shi Xuan Feng") <br>所需PHP扩展:curl 。字符编码均为GBK(考虑拼音转换) <br>*/ <br>//引入拼音转换需要文件 <br>include("libs/pinyin.php"); <br>include "libs/googlevoice.class.php"; <br>#设置google voice 帐号密码 <br>$username="username@gmail.com"; <br>$password="password"; <br>//接受号码,多号码用","分隔(86159..,86159..) <br>$sendto ="8615900000000,8613400000000"; <br>//消息内容 <br>$message = "I am from heqee.com"; <br>/* <br>转换中文为拼音程序自动识别中文进行替换, <br>此功能个人认为纯属娱乐,可以根据实际情况决定是否添加. <br>*/ <br>//$message = zh2pinyin($message); <br>//实例化(必须) <br>$sms = new GoogleVoice($username,$password); <br>//返回结果 <br>//Text sent to 86134... <br>echo $sms ->send($sendto,$message); <br>?> <br> <br>源码库打包下载/201007/yuanma/GoogleVoiceApi.rar

人气教程排行