Apsara interface instance code _ PHP Tutorial

Source: Internet
Author: User
The application code of the Apsara stack interface instance. Apsara stack interface instance application code header (content-type: texthtml; charsetutf-8); error_reporting (0); include .. libsfetion. class. php Tutorial; $ demo $ _ g Feixin 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 and separate them with commas (,) (159..., 159...), contact qq: 85431993 for more suggestions.
E-mail: threesky@gmail.com ';

$ Api = "this site interface:
Http://api.heqee.com/fetion? Username = Feixin mobile phone number & passowrd = Feixin mobile phone password & to = recipient's number & message = SMS content
Or
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 ("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 ('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

/*
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 ";
}


Header (content-type: text/html; charset = utf-8); error_reporting (0); include .. /libs/fetion. class. php Tutorial; $ demo = $ _ g...

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.