PHP website text message interface source code
function Post($data, $target) { $url_info = parse_url($target); $httpheader = "POST " . $url_info['path'] . " HTTP/1.0\r\n"; $httpheader .= "Host:" . $url_info['host'] . "\r\n"; $httpheader .= "Content-Type:application/x-www-form-urlencoded\r\n"; $httpheader .= "Content-Length:" . strlen($data) . "\r\n"; $httpheader .= "Connection:close\r\n\r\n"; //$httpheader .= "Connection:Keep-Alive\r\n\r\n"; $httpheader .= $data; $fd = fsockopen($url_info['host'], 80); fwrite($fd, $httpheader); $gets = ""; while(!feof($fd)) { $gets .= fread($fd, 128); } fclose($fd); return $gets;
2.
[Code][PHP] code
Include_once ('SMS. php '); $ target = "http: // 10.1.120.22/SmsMmsWebService/Service. asmx/g_Submit "; // replace it with your test account, the parameter order corresponds to $ post_data = "sname = kwsm & spwd = kwsm & scorpid = & sprdid = 101 & sdst = 13910862579 & smsg = ". rawurlencode ("SMS content"); // $ binarydata = pack ("A", $ post_data); echo $ gets = Post ($ post_data, $ target ); // Parse the $ gets string and implement your own logic. // 0 indicates that the string is successful. Other references