Apsara stack interface instance application code

Source: Internet
Author: User

Apsara stack interface instance application code

Apsara stack 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 group multiple numbers, separate them with commas (,) (159 .., 159 ..), for more suggestions, please contact qq: 85431993 <br> e-mail: threesky@gmail.com ';

$ Api = "site interface: <br> http://api.heqee.com/fetion? Username = Feixin mobile phone number & passowrd = Feixin mobile phone password & to = recipient number & message = SMS content <br> or <br> http://api.heqee.com/fetion? U = Feixin mobile phone number & p = Feixin mobile phone password & t = recipient number & m = SMS 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 ("<B> heqee info: </B>". $ 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 ('Enter the number of the login mobile phone .');
Break;
Case $ send ['Password'] = null:
Error ('enter your mobile phone login password .');
Break;
Case $ send ['to'] = null:
Error ('Enter the number of the recipient's cell phone .');
Break;
Case $ send ['message'] = null:
Error ('Enter the text message content .');
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']);

 

?>

// Instance application

<? Php
/*
Required php extensions: curl and simplexml
*/
Include "libs/fetion. class. php ";
# Set the Apsara stack account password
$ Username = "15900000000 ";
$ Password = "password ";
// Receive number. Multiple numbers are separated by commas (,) (159, 159 ..)
$ Sendto = "15900000000,13400000000 ";
// Message content
$ Message = "I am from heqee.com ";
// Instantiate (required)
$ Fetion = new fetion ($ username, $ password );
// Send a Boolean response
$ Sms = $ fetion-> send ($ sendto, $ message );
If ($ sms ){
Echo "OK ";
}


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.