Php short message sending function-text message sending function created by the php short message interface author: zccst version 1: Sometimes when you are using php integration, text messages are often used on webpages, the text message can be sent as a function to facilitate future calls. If you can define a Function in Function. php, the code is as follows: php SMS sending Function-the short message sending Function created by the php SMS interface
Author: zccst
Version 1:
Sometimes, when you are using php integration, text messages are often used on webpages. you can send text messages as a function to facilitate future calls.
If you can define a Function in Function. php, the code is as follows:
Function smsto ($ telphone, $ message) {// user name of the SMS interface $ uid. if there is no or cannot be sent, contact customer service QQ: 272927682 $ uid = 'qxt01 '; // SMS interface password $ passwd = '000000'; // sent to the target mobile phone number $ telphone // $ telphone = '000000 '; // change your mobile phone number here // The text message content $ message // $ message = "this is a test message"; $ message1 = urlencode (mb_convert_encoding ($ message, 'utf-8', 'gb2312'); $ gateway = "http://sms.zgqxt.com/msgsend.ashx? USERNAME = {$ uid} & PASSWORD = {$ passwd} & MOBILE = {$ telphone} & CONTENT = {$ message1} & SEQ = 1000 "; $ result = file_get_contents ($ gateway); return $ result ;}
Then implement sending on the relevant page, and return the sending result as follows:
$ SendMember = $ _ POST ["SendMember"]; // Note: You can specify the mobile phone number $ SendMSG = $ _ POST ["SendMSG"] by yourself. // Note: You can specify the content $ smsok = smsto ($ SendMember, $ SendMSG) based on the text message you entered );
The return value 1 indicates that the operation is successful. For more information about the returned values, see the interface description.
Version 2:
Step 1: First register a member account at www.woxp.cn;
Step 2: Insert the code in the test. php file:
Step 3: Browse test. php. if the parameter is correctly configured, the text message can be successfully sent to the preset mobile phone number!