I've seen so many solutions for this but haven't been able to implement any of them sucessfully. I have created an App in Facebook and can successfully use FQL to retrieve data. I will be pulling in event information from pages and groups that I am part of. I will only parse the event information of those who explicitly register with my App/website.
I'm using the Facebook PHP SDK. The issue is that I want to create a cron task to retrieve event information periodically, but I don't know how to allow the cron task to log in automatically.
I've seen that there are real-time updates, but as far as I know, they don't show events.
I tried to use cURL but it just brought up a blank screen. The code was:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://login.facebook.com/login.php?');
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'facebook_cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'facebook_cookies.txt');
curl_setopt($ch, CURLOPT_USERAGENT,
"Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20100101 Firefox/12.0");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$email = 'xxxxxxxxxxx';
$pass = 'xxxxxxxxxxx';
curl_setopt($ch, CURLOPT_POSTFIELDS, 'email='.urlencode($email).'&
pass='.urlencode($pass).'&login=Login');
$result = curl_exec($ch);
echo $result;
curl_close($ch);
That was taken from another SO question: Remote login to facebook account