php SMS interface

Jul 25, 2016 am 09:08 AM

Applicable industries: finance, industry and commerce, taxation, electricity, trade, commerce, tourism, government, postal service, education and other industries

Applicable types: connected to various B/S systems, used as various office systems, ERP, CRM, Plug-ins for e-commerce platforms (such as group text message meeting notifications, member/customer relationship communication, order generation notifications, shipping notifications, schedule reminders, reminder notifications, etc.)

Features: Green text messages, legal and formal channels, sending and receiving across the entire network
Supports text messages from China Mobile, China Unicom, China Telecom, and China Netcom, two-way interaction, and can reply to high-speed group messages

Free account application (please indicate that you are from "Shangmai Unlimited SMS Interface", 50 text messages will be given as a gift, please contact me if the test text messages are not enough)

* SMS interface file:

/*--------------------------------
Function: Unlimited business connections PHP HTTP interface to send SMS
Modification date: 2011-04-08
Description: http://http.smsdk.com/tx/?uid=user account&pwd=MD5-digit 32-digit password&mobile=number&content=content
Status:
100 Sent successfully
101 Verification failed
102 Insufficient text messages
103 Operation failed
104 Illegal characters
105 Too much content
106 Too many numbers
107 Frequency too fast
108 Number content is empty
109 Account frozen
110 Frequent single sending is prohibited
111 The system is tentatively sending
112 The number is incorrect
120 System upgrade
--------------------------------*/
$uid = '9999'; //User account
$pwd = '9999'; //Password
$mobile = '13912341234,13312341234,13512341234,02122334444'; //Number
$content = 'Shangmai Wuxian PHP HTTP interface '; //Content
//Send immediately
$res = sendSMS($uid,$pwd,$mobile,$content);
echo $res;

//Send regularly
/*
$time = '2010-05-27 12:11';
$res = sendSMS($uid,$pwd,$mobile,$content,$time);
echo $res ;
*/
function sendSMS($uid,$pwd,$mobile,$content,$time='',$mid='')
{
$http = 'http://http.c123.com/tx /';
$data = array
(
'uid'=>$uid, //User account
'pwd'=>strtolower(md5($pwd)), //MD5-digit 32 password
'mobile'=> $mobile, //Number
'content'=>$content, //Content
'time'=>$time, //Send regularly
'mid'=>$mid //Sub extension number
);
$re = postSMS($http,$data); //POST submission
if( trim($re) == '100' )
{
return "Send successfully!";
}
else
{
return "Send failed ! Status: ".$re;
}
}

function postSMS($url,$data='')
{
$row = parse_url($url);
$host = $row['host'];
$port = $row['port'] ? $row['port']:80;
$file = $row['path'];
while (list($k,$v) = each($data))
{
$post .= rawurlencode($ k)."=".rawurlencode($v)."&"; //Convert to URL standard code
}
$post = substr( $post , 0 , -1 );
$len = strlen($post);
$fp = @fsockopen( $host ,$port, $errno, $errstr, 10);
if (!$fp) {
return "$errstr ($errno)n";
} else {
$receive = '';
$out = "POST $file HTTP/1.1rn";
$out .= "Host: $hostrn";
$out .= "Content-type: application/x-www-form-urlencodedrn";
$out .= "Connection: Closern";
$out .= "Content-Length: $lenrnrn";
$out .= $post;
fwrite($fp, $out);
while (!feof($ fp)) {
$receive .= fgets($fp, 128);
}
fclose($fp);
$receive = explode("rnrn",$receive);
unset($receive[0]);
return implode("",$receive);
}
}
?>
Detailed introduction: http://www.smsdk.com/a/gb2312/news/20111205/117.html

  1. * SMS interface file:
  2. /*--------------------------------
  3. Function : Shangmai Wuxian PHP HTTP interface to send text messages
  4. Modification date: 2011-04-08
  5. Instructions: http://http.smsdk.com/tx/?uid=user account&pwd=MD5-digit 32-digit password&mobile=number&content=content
  6. Status:
  7. 100 Successfully sent
  8. 101 Verification failed
  9. 102 Insufficient text message
  10. 103 Operation failed
  11. 104 Illegal characters
  12. 105 Too much content
  13. 106 Too many numbers
  14. 107 Frequency too fast
  15. 108 Number content is empty
  16. 109 Account frozen
  17. 110 Prohibited Frequent single message sending
  18. 111 The system is tentatively sending it
  19. 112 The number is incorrect
  20. 120 System upgrade
  21. ---------------------------------- -*/
  22. $uid = '9999'; //User account
  23. $pwd = '9999'; //Password
  24. $mobile = '13912341234,13312341234,13512341234,02122334444'; //Number
  25. $content = 'Business Line Unlimited PHP HTTP interface'; //Content
  26. //Send immediately
  27. $res = sendSMS($uid,$pwd,$mobile,$content);
  28. echo $res;
  29. //Send regularly
  30. /*
  31. $time = '2010-05-27 12:11';
  32. $res = sendSMS($uid,$pwd,$mobile,$content,$time);
  33. echo $res;
  34. */
  35. function sendSMS($uid,$ pwd,$mobile,$content,$time='',$mid='')
  36. {
  37. $http = 'http://http.c123.com/tx/';
  38. $data = array
  39. (
  40. ' uid'=>$uid, //User account
  41. 'pwd'=>strtolower(md5($pwd)), //MD5-digit 32 password
  42. 'mobile'=>$mobile, //Number
  43. 'content '=>$content, //Content
  44. 'time'=>$time, //Send regularly
  45. 'mid'=>$mid //Sub-extension number
  46. );
  47. $re= postSMS($http, $data); //POST method submission
  48. if( trim($re) == '100' )
  49. {
  50. return "Sent successfully!";
  51. }
  52. else
  53. {
  54. return "Sending failed! Status:".$ re;
  55. }
  56. }
  57. function postSMS($url,$data='')
  58. {
  59. $row = parse_url($url);
  60. $host = $row['host'];
  61. $port = $row ['port'] ? $row['port']:80;
  62. $file = $row['path'];
  63. while (list($k,$v) = each($data))
  64. {
  65. $ post .= rawurlencode($k)."=".rawurlencode($v)."&"; //Convert to URL standard code
  66. }
  67. $post = substr( $post , 0 , -1 );
  68. $len = strlen($post);
  69. $fp = @fsockopen( $host ,$port, $errno, $errstr, 10);
  70. if (!$fp) {
  71. return "$errstr ($errno)n";
  72. } else {
  73. $receive = '';
  74. $out = "POST $file HTTP/1.1rn";
  75. $out .= "Host: $hostrn";
  76. $out .= "Content-type: application/x-www -form-urlencodedrn";
  77. $out .= "Connection: Closern";
  78. $out .= "Content-Length: $lenrnrn";
  79. $out .= $post;
  80. fwrite($fp, $out);
  81. while (!feof($fp)) {
  82. $receive .= fgets($fp, 128);
  83. }
  84. fclose($fp);
  85. $receive = explode("rnrn",$receive);
  86. unset($ receive[0]);
  87. return implode("",$receive);
  88. }
  89. }
  90. ?>
  91. Detailed introduction: http://www.smsdk.com/a/gb2312/news/20111205/117.html
Copy code


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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Explain the concept of late static binding in PHP. Explain the concept of late static binding in PHP. Mar 21, 2025 pm 01:33 PM

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

How does session hijacking work and how can you mitigate it in PHP? How does session hijacking work and how can you mitigate it in PHP? Apr 06, 2025 am 12:02 AM

Session hijacking can be achieved through the following steps: 1. Obtain the session ID, 2. Use the session ID, 3. Keep the session active. The methods to prevent session hijacking in PHP include: 1. Use the session_regenerate_id() function to regenerate the session ID, 2. Store session data through the database, 3. Ensure that all session data is transmitted through HTTPS.

Describe the SOLID principles and how they apply to PHP development. Describe the SOLID principles and how they apply to PHP development. Apr 03, 2025 am 12:04 AM

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

How to automatically set permissions of unixsocket after system restart? How to automatically set permissions of unixsocket after system restart? Mar 31, 2025 pm 11:54 PM

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

Explain late static binding in PHP (static::). Explain late static binding in PHP (static::). Apr 03, 2025 am 12:04 AM

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

How to debug CLI mode in PHPStorm? How to debug CLI mode in PHPStorm? Apr 01, 2025 pm 02:57 PM

How to debug CLI mode in PHPStorm? When developing with PHPStorm, sometimes we need to debug PHP in command line interface (CLI) mode...

See all articles