Home > Backend Development > PHP Tutorial > PHP implements mobile phone location query API interface_PHP tutorial

PHP implements mobile phone location query API interface_PHP tutorial

WBOY
Release: 2016-07-13 17:53:06
Original
778 people have browsed it

This API has not been tested by this site. The webmaster will update it as soon as possible after testing it. stay tuned. Thank you for your support!
Mainly implemented using curl, you need to enable PHP's support for curl.
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 number format error!’;
} else {
echo $data;
}
}
?>


Mobile phone number:

Author: Ah He

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478054.htmlTechArticleThis API has not been tested by this site. The webmaster will update it as soon as possible after testing it. stay tuned. Thank you for your support! Mainly implemented using curl, you need to enable PHP's support for curl. ?php header(Conten...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template