0

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

Community
  • 1
  • 1
Jay
  • 558
  • 1
  • 7
  • 23
  • Maybe you don't need to log, app access_token can't solve your problem? https://developers.facebook.com/docs/opengraph/using-app-tokens/ – Guilherme Torres Castro Jul 12 '12 at 20:02
  • Don’t scrape Facebook’s pages, use the Graph API to get information. – CBroe Jul 12 '12 at 20:13
  • @GuilhermeTorresCastro: Thanks for the link. I missed that. I'm still unsure if that will allow me to gain access to events: "While an App Access Token is largely for the purposes of publishing information back to Facebook on behalf of the user, there is a limited set of information that can be retrieved from Facebook using an App Access Token.Basic Profile Info of a User (ID, Name, Username, Gender); A User’s Friends and their IDs; Permissions granted by the User to your App". I'm still trying to wrap my head around their terminology. – Jay Jul 12 '12 at 21:46
  • @CBroe: When I said "parse", I actually meant that I'll be using their Graph API or their FQL. – Jay Jul 12 '12 at 21:47
  • @GuilhermeTorresCastro: can you please write your comment in the form of a question so that I can mark it as the correct answer? I used the App access token without the need to log in. – Jay Jul 16 '12 at 15:55

1 Answers1

3

Maybe you don't need to log, app access_token can't solve your problem?

Guilherme Torres Castro
  • 15,135
  • 7
  • 59
  • 96