Updating Facebook Status Using PHP and Cron

Can facebook php api and crontab be used to create status updates? Crontab will run php code that sends the status update to facebook.

The problem for me is part of the login [$ facebook-> require_login ();]. Crontab cannot login, so can I send login information (username and password) to facebook?

my code example:

$facebook = new Facebook($api_key, $secret); $user = $facebook->require_login(); $output = "my status"; $result = $facebook->api_client->users_setStatus($output); 
+4
source share
3 answers

It is possible. A quick google search found this example in perl . Here is another in bash . Just like a side note, you should try to make sure your credentials are protected by permissions.

Also consider these possible duplicates:

+2
source

First you need to require extended permissions offline_access and status_update.

After you have saved the infinite session key, you can now use set_user in your cron.

 $facebook = new Facebook(API_KEY, API_SECRET); $facebook->set_user($user_id, $infinit_session); 
+1
source

Remove require_login() because cronjobs will not be able to do this. Make sure you have advanced permissions from the application so that cronjob can update your status.

0
source

All Articles