SMS interface address//Send service-side colleague deposit
$target = "Http://*********.php?method=submit";
$phone = $_request[' phone ']; Accept incoming phone numbers from the foreground
$post _data = "account=*****&password=*******&mobile=". $phone. " &content= ". Rawurlencode (" ********** ");
$data = Post ($post _data, $target); Calling methods
Print_r ($data);d ie;
$str = simplexml_load_string ($data); return value
$str = Json_encode ($STR);
$str = Json_decode ($str, true);
Print_r ($STR);d ie;
if ($str [' Code ']!=2) {
Echo ' send failed ';
}else{
Echo ' Pro, sent successfully ';
}
function Post ($curlPost, $url) {///The second parameter is the SMS platform URL, the first parameter checks whether the environment turns on Curl init for the SMS content parameter.
$curl = Curl_init ();
curl_setopt ($curl, Curlopt_url, $url);
curl_setopt ($curl, Curlopt_header, false);
curl_setopt ($curl, Curlopt_returntransfer, true);
curl_setopt ($curl, Curlopt_nobody, true);
curl_setopt ($curl, Curlopt_post, true);
curl_setopt ($curl, Curlopt_postfields, $curlPost);
$return _str = curl_exec ($curl);
Curl_close ($curl);
return $return _str;
}
[PHP] Small quiet fun life of the SMS interface