Home  >  Article  >  Backend Development  >  China Unicom mobile phone number location query PHP mobile phone location query api

China Unicom mobile phone number location query PHP mobile phone location query api

WBOY
WBOYOriginal
2016-07-29 08:41:471112browse

Copy the code The code is as follows:


header("Content-Type:text/html;charset=utf-8");
if (isset($_GET['number']) ) {
$url = 'http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx/getMobileCodeInfo';
$number = $_GET['number'];
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, "mobileCode={$number}&userId=");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );
$data = curl_exec($ch);
curl_close($ch);
$data = simplexml_load_string($data);
if (strpos($data, 'http://')) {
echo 'Mobile phone Wrong number format!';
} else {
echo $data;
}
}
?>


Mobile phone number:

The above introduces the China Unicom mobile phone number location inquiry PHP mobile phone location inquiry API, including the content of China Unicom mobile phone number location inquiry. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
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