飞信接口实例应用代码_PHP教程

php中文网
发布: 2016-07-20 11:08:16
原创
1030人浏览过

飞信接口实例应用代码

飞信接口实例应用代码

header("content-type: text/html; charset=utf-8");error_reporting(0);include "../libs/fetion.class.php教程";$demo = $_get[demo];$help = '帮助:如果需要群发多号用英文逗号(,)分隔(159..,159..),有更多建议请联系 qq:85431993e-mail:threesky@gmail.com';$api = "本站接口:http://api.heqee.com/fetion/?username=飞信手机号码&passowrd=飞信手机密码&to=接收人号码&message=短信内容或者http://api.heqee.com/fetion/?u=飞信手机号码&p=飞信手机密码&t=接收人号码&m=短信内容";if($demo!=""){  if(!in_array($demo,array("send","code","help","api"))){error("参数错误!");}  switch($demo){ case "code":  exit(highlight_file("demo.php",true)); break; case "help":  exit($help); break; case "api":  exit($api); break;  }}function getval($key){ if(!isset($_post[$key])||$_post[$key]==null||$_post[$key]==''){  return ($_get[$key] !=''&& isset($_get[$key])) ? trim($_get[$key]) : null; }else{  return ($_post[$key] !=''&& isset($_post[$key])) ? trim($_post[$key]) : null; }}function error($msg){ exit("heqee info: ".$msg);}function gbktoutf8 ($value) {  return iconv("gbk", "utf-8", $value); }$send=array();$send['username'] = getval('username') != null ? getval('username') : getval('u');$send['password'] = getval('password') != null ? getval('password') : getval('p');$send['to']   = getval('to') != null ? getval('to') : getval('t');$send['message']  = gbktoutf8(getval('message') != null ? getval('message') : getval('m'));$send['message_len']=strlen($send['message']);switch($send){ case $send['username']==null:  error('请输入登陆手机的号码.'); break; case $send['password']==null:  error('请输入登陆手机的密码.'); break; case $send['to']==null:  error('请输入接收手机的号码.'); break; case $send['message']==null:  error('请输入短信内容.'); break; case $send['message_len'] >360:  error('消息内容不能超过180个字符.'); break;}$fetion = new fetion($send['username'], $send['password']);$fetion->send($send['to'],$send['message']); ?>

//实例应用

/*
所需php扩展:curl, simplexml
*/
include "libs/fetion.class.php";
#设置飞信帐号密码
$username="15900000000";
$password="password";
//接收号码,多号码用","分隔(159..,159..)
$sendto ="15900000000,13400000000";
//消息内容
$message = "i am from heqee.com";
//实例化(必须)
$fetion = new fetion($username,$password);
//发送 返回布尔
$sms = $fetion->send($sendto,$message);
if($sms){
 echo "ok";
}


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/444879.htmlTechArticle飞信接口实例应用代码 飞信接口实例应用代码 header(content-type: text/html; charset=utf-8); error_reporting(0); include ../libs/fetion.class.php教程; $demo = $_g...
相关标签:
PHP速学教程(入门到精通)
PHP速学教程(入门到精通)

PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号