问题
I want to get the list of all the restaurant pages that are based in New York using Facebook Graph API. I have downloaded the PHP-SDK and now I am stuck with this problem. I only need the id of the restaurant pages.
<?php
$url = "https://graph.facebook.com/search?q=restaurant&type=page";
$result = file_get_contents($url,true);
$result = json_decode($result);
//print_r($result);
$i = 25;
for($a=0;$a<$i;$a++) {
$restaurantName = $result->data[$a]->name;
$restaurantCategory = $result->data[$a]->category;
$restaurantPage_id = $result->data[$a]->id;
}
?>
Now as you can see in the above code I get all types of category(like APP, Food & Beverage, Company, etc) and from different parts of the world. I only want restaurants from New York and really don't know how to filter the result.
Any help will really be appreciated.
回答1:
Replace this url,
$url ="https://graph.facebook.com/search?q=restaurant&type=place¢er=40.714623,-74.006605&distance=16000&access_token=`Your_Access_Token`";
New York center latitude=40.714623 & longitude=-74.006605. An access token is required to request this resource.
May this help you.
来源:https://stackoverflow.com/questions/10258589/get-list-of-restaurants-from-new-york-city-using-facebook-graph-api