-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmap.php
30 lines (29 loc) · 790 Bytes
/
map.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
function get_content($URL){
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13');
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
if(!empty($_GET['id'])){
$id= $_GET['id'];
$URL='http://pubapi.yp.com/search-api/search/devapi/listingmap?key=0z02n4301r&format=json&listingid='.urlencode($id);
$JSON= get_content($URL);
$array=json_decode($JSON,true);
if(isset($array['map_url'])&&$array['map_url']!==''){
$mapurl=$array['map_url'];
echo "<img src='$mapurl'>";
}
else{
echo"No MAP!.";
}
}
?>
<html>
<head>
<title> map </title>
</head>
</html>