2012年6月7日 星期四

foursquare venues platform 地標資料

foursquare venues platform 提供不需認證即可取得資料的API
每小時可連線五千次
https://developer.foursquare.com/overview/venues
範例程式碼

<?php
$query = 'https://api.foursquare.com/v2/venues/search?ll='.$lat.','.$long.'&client_id='.$foursquare_app_id.'&client_secret='.$foursquare_app_secret.'&v='.date('Ymd');
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $query);
$query_res = curl_exec($ch);
curl_close($ch);
$res = json_decode($query_res);
var_dump($res);

?>

沒有留言:

張貼留言