Home > Backend Development > PHP Tutorial > Fetion interface example application code_PHP tutorial

Fetion interface example application code_PHP tutorial

WBOY
Release: 2016-07-20 11:08:16
Original
869 people have browsed it

Fetion interface instance application code

Fetion interface instance application code

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

error_reporting(0 );

include "../libs/fetion.class.php tutorial";


$demo = $_get[demo];

$help = 'Help: If you need to send multiple numbers in groups, separate them with English commas (,) (159..,159..). If you have more suggestions, please contact qq:85431993
e-mail:threesky@gmail.com';

$api = "This website interface:
http://api.heqee.com/fetion/?username=Fetion mobile phone number&passowrd=Fetion mobile phone password&to=recipient number&message=SMS content< br>or
http://api.heqee.com/fetion/?u=Fetion mobile number&p=Fetion mobile password&t=recipient number&m=text message content";

if($ demo!=""){
if(!in_array($demo,array("send","code","help","api"))){error("Parameter 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('Please enter your mobile phone number.');
break;
case $send['password']==null:
error( 'Please enter the password to log in to your mobile phone.');
break;
case $send['to']==null:
error('Please enter the number of the receiving mobile phone.');
break;
case $send['message']==null:
error('Please enter the content of the message.');
break;
case $send['message_len'] >360 :
error('Message content cannot exceed 180 characters.');
break;
}

$fetion = new fetion($send['username'], $send[ 'password']);

$fetion->send($send['to'],$send['message']);

?> ;

//Example application

/*
Required php extensions: curl, simplexml
*/
include "libs/fetion.class.php";
#Set Fetion account password
$username="15900000000";
$password="password";
//Receive numbers, multiple numbers Use "," to separate (159..,159..)
$sendto ="15900000000,13400000000";
//Message content
$message = "i am from heqee.com";
//Instantiation (required)
$fetion = new fetion($username,$password);
//Send return Boolean
$sms = $fetion->send($sendto,$message );
if($sms){
echo "ok";
}


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/444879.htmlTechArticleFetion interface example application code Fetion interface example application code header(content-type: text/html; charset=utf- 8); error_reporting(0); include ../libs/fetion.class.php tutorial; $demo = $_g...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template