phpfacebook-graph-apigeotargetting

Geotargeting Page Posts with the Facebook API


I'm trying to geotarget wall posts to my fan page using the Facebook PHP SDK.

The following snippet successfully posts a message to my wall, but the geotargeting isn't taking.

I'm new to programming and I've done my best to follow the documentation here but it's pretty sparse -- I'm not confident that my syntax is correct.

Any help would be very much appreciated.

//compiling the geotargeting parameters
$geoTarget = "{'cities':'Richmond,VA','regions':'Virginia','countries':'US'}";

//my arguments
$args = array(
'access_token'  => $page_access_token,
'message'       => "this is my message",
'targeting' => $geoTarget
);

//posts the message
$facebook->api("/$page_id/feed","post",$args);

Solution

  • The field is privacy in the Post table

    The description field may contain a comma-separated lists of valid country, city and language if a Page's post targeting by location/language is specified.

    http://developers.facebook.com/docs/reference/api/post/