问题
My app lets users checkin with lat, lon and place name to Facebook. But I don't know how to deal with "place" parameter.
Is there any way to get or create one?
回答1:
Each checkinable place must have a valid Place Facebook Page.
The place
parameter takes in the page_id
of a Place Facebook Page.
For example, page_id
104999729569954 of Place Facebook Page http://www.facebook.com/pages/Nanyang-Polytechnic/104999729569954
If your application is letting your users to checkin based on their current location
1) Use an external map service such as Google Map's Geolocation to get the coordinates(lat & lon) of your user's current location.
The set of coordinates returned from Google Map is different from Facebook's own set of coordinates.
2) To overcome this, do a FQL query to find the closest match of Facebook's coordinates with Google Map's coordinates.
SELECT page_id,latitude,longitude FROM place WHERE distance(latitude, longitude, "LAT_HERE", "LON_HERE") < 250
250
refers to the radius(m) that it will search within, it can go up to 50000
.
3) Now that you have page_id
, latitude
and longitude
. Assign page_id
into place
parameter. Assign latitude
and longitude
into coordinates
parameter. You will then be able to publish checkin.
You can refer to publish checkin examples that I have posted over here. Facebook - Publish Checkins using PHP SDK/JavaScript SDK
If your application is letting your users to checkin based on selection from a list of place names or gallery of images (in a game or something)
You will just need to find the page_id
of each place and bind them to respective place name or image.
Documentation
Page FQL - http://developers.facebook.com/docs/reference/fql/page/
Checkins API - http://developers.facebook.com/docs/reference/api/user/#checkins
回答2:
Maybe this is what you want. Open graph explorer Just replace URL with any facebook page url
fql?q=SELECT id FROM object_url WHERE url="https://www.facebook.com/LegendCinema"
来源:https://stackoverflow.com/questions/11828940/how-to-get-place-id-before-checkin