飛信介面執行個體應用代碼_PHP教程

來源:互聯網
上載者:User
飛信介面執行個體應用代碼

飛信介面執行個體應用代碼

header("content-type: text/html; charset=utf-8");

error_reporting(0);

include "../libs/fetion.class.php教程";


$demo = $_get[demo];

$help = '協助:如果需要群發多號用英文逗號(,)分隔(159..,159..),有更多建議請聯絡 qq:85431993
e-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";
}


http://www.bkjia.com/PHPjc/444879.htmlwww.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...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.