<?php
function
inquiry_number_infor(
$phonenumber
)
{
$url
=
"http://api./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"
);
print_r(
$ret
);