Hi,
I have my code to post directly to Facebook using the API but I am generating the access-token manually
I want to to know how can I generate an access token using PHP in order to use it in my status update's code?
Thanks
Jassim
Hi,
I have my code to post directly to Facebook using the API but I am generating the access-token manually
I want to to know how can I generate an access token using PHP in order to use it in my status update's code?
Thanks
Jassim
here is the code I am using but I still need to obtain the access-token for it:
<?php
class PublishOnFacebook
{
function status_update($status_text)
{
require_once("facebook/facebook.php");
$config = array();
$config['pageId'] = 'xxxxxxxxxx';
$config['appId'] = 'yyyyyyyyyy';
$config['secret'] = 'zzzzzzzzzzzzz';
$config['fileUpload'] = false;
$fb = new Facebook($config);
$params = array(
"access_token" => $config['appId'] . "|" . $config['secret'],
"message" => $status_text,
"link" => "http://www.pontikis.net/blog/auto_post_on_facebook_with_php",
"picture" => "http://i.imgur.com/lHkOsiH.png",
"name" => "How to Auto Post on Facebook with PHP",
"caption" => "www.pontikis.net",
"description" => "Automatically post on Facebook with PHP using Facebook PHP SDK. How to create a Facebook app. Obtain and extend Facebook access tokens. Cron automation."
);
try
{
$ret = $fb->api('/xxxxxxxxxx/feed', 'POST', $params);
echo 'Successfully posted to Facebook';
}
catch(Exception $e)
{
echo $e->getMessage();
}
}
}
?>