<?phpfunction inquiry_number_infor ($phonenumber)/** incoming mobile phone number, through the API to XML format data, further parsing the XML, and finally return the corresponding number information array. * * @param string $phonenumber * * @return array*/{$url = "Http://api.showji.com/Locating/default . aspx?m= $phonenumber &output=xml&callback=querycallback "; $lines _array = file ($url); $lines _string = Implode (", $lines _array); Echo htmlspecialchars ($lines _string); echo "</br>"; $p = Xml_parser_create (); Xml_parse_into_struct ($p, $lines _string, $vals, $index); Xml_parser_free ($p); $return _arr = Array (); foreach ($vals as $val) {$key = $val ["tag"]; if ($key! = "Queryresponse") {$value = $val ["Value"]; $return _arr[$key] = $value; } if ($key = = = "QueryResult" && $value = = = "False") break; } return $return _arr;} $ret = Inquiry_number_infor ("11210982674 "),//$ret = Inquiry_number_infor (" 15210982674 ");p Rint_r ($ret);
How PHP gets the local phone number