The PHP code of the SMS platform is always available. There have been many opportunities to access the text messaging platform in recent times. it seems that the customer's text messaging platform was developed using PHP. the code is as follows :? PHP has a lot of opportunities to access the text messaging platform in the recent period. think about it as if the customer's text messaging platform was developed using PHP. the code is as follows:
$ Flag = 0;
// Data to be post
$ Argv = array (
'SN '=> 'sdk-BBX-010-XXXXX ',
'Pwd' => 'xxxxxx ',
'Mobile' => '134338xxxxx', // mobile phone number of the test
'Content' => 'Hello, test SMS'
);
// Construct the string to post
Foreach ($ argv as $ key => $ value ){
If ($ flag! = 0 ){
$ Params. = "&";
$ Flag = 1;
}
$ Params. = $ key. "="; $ params. = urlencode ($ value );
$ Flag = 1;
}
$ Length = strlen ($ params );
// Create a socket connection
$ Fp = fsockopen ("sdk2.entinfo.cn", 80, $ errno, $ errstr, 10) or exit ($ errstr. "--->". $ errno );
// Construct the post request header
$ Header = "POST/z_send.aspx HTTP/1.1 \ r \ n ";
$ Header. = "Host: sdk2.entinfo.cn \ r \ n ";
$ Header. = "Referer:/mobile/sendpost. php \ r \ n ";
$ Header. = "Content-Type: application/x-www-form-urlencoded \ r \ n ";
$ Header. = "Content-Length:". $ length. "\ r \ n ";
$ Header. = "Connection: Close \ r \ n ";
// Add the post string
$ Header. = $ params. "\ r \ n ";
// Send post data
Fputs ($ fp, $ header );
$ Inheader = 1;
While (! Feof ($ fp )){
$ Line = fgets ($ fp, 1024); // only the returned data on the page is displayed when the request packet header is removed.
If ($ inheader & ($ line = "\ n" | $ line = "\ r \ n ")){
$ Inheader = 0;
}
If ($ inheader = 0 ){
// Echo $ line;
}
}
If ($ line = 1)
{
Echo 'message sent successfully, please check the returned value '. $ line;
} Else
{
Echo 'message sending failed. Please check the returned values of related errors '. $ line;
}
Fclose ($ fp );
Why :? PHP...