Facebook API - Share posts to page with specific targeting
I'm developing APP that shares posts on specific page. I need attach to
the posts some target parameters e.g city and country ( show posts to the
people who targets specified locations ). My code is here but it does not
works.
if( count( $DataArray ) > 0 ) {
$MessageData = null;
$AccessToken = $this->GetAccessToken();
foreach( $DataArray as $ItemArray ) {
$CleanTitle = $this->ValidateTitle( $ItemArray['title'],
$NotAcceptableWords );
$GenerateMessageStr = "{$CleanTitle} -
http://www.alecoder.com/ID/{$Item['id']}/Feed/";
$Target = array(
'cities' => array( 'name' => 'Paris,France' )
);
$MessageData = array (
'access_token' => $AccessToken,
'message' => $GenerateMessageStr,
'targeting' => $Target
//'place' => '111615355559307'
);
try {
$this->FacebookObject->api("/{$this->FacebookPageId}/feed",
'POST', $MessageData);
}
catch (FacebookApiException $e) {
echo "<pre>";
print_r($e);
echo "</pre>";
}
}
}
Can anyone explain how this feature works ?
No comments:
Post a Comment