Home  >  Article  >  Backend Development  >  PHP implements mobile phone location query API interface implementation code_PHP tutorial

PHP implements mobile phone location query API interface implementation code_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:16:32941browse

复制代码 代码如下:

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 ‘手机号码格式错误!';
} else {
echo $data;
}
}
?>

手机号码:

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/325909.htmlTechArticle复制代码 代码如下: ?php header(“Content-Type:text/html;charset=utf-8″); if (isset($_GET['number'])) { $url = ‘http://webservice.webxml.com.cn/WebServices/MobileCodeWS...
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