1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Script That Triggers a Post When A Facebook Fan Page Is Updated?

Discussion in 'FaceBook' started by milton, Jun 14, 2010.

  1. milton

    milton Regular Member

    Joined:
    May 21, 2010
    Messages:
    271
    Likes Received:
    60
    Is it possible to make a script, that is triggered when a Facebook Fan Page is updated?

    So if a Facebook Fan Page makes a posting, the script sees the posting, then triggers an specified action?
     
  2. fatboy

    fatboy Elite Member

    Joined:
    Aug 13, 2008
    Messages:
    1,618
    Likes Received:
    3,227
    Occupation:
    Retired
    Location:
    Old Peoples Home
    Easiest thing to do is write a script that scrapes the page and record what it sees.
    Next time it scrapes, it compares with the last saved version - if its changed, do an action.

    Just off the top of me head, never played with fan pages......
     
  3. Peter Shaw

    Peter Shaw BANNED BANNED

    Joined:
    Sep 1, 2009
    Messages:
    902
    Likes Received:
    359
    But if the page has more comment since, its going to make an action?
     
  4. fatboy

    fatboy Elite Member

    Joined:
    Aug 13, 2008
    Messages:
    1,618
    Likes Received:
    3,227
    Occupation:
    Retired
    Location:
    Old Peoples Home
    If the page has changed compared to the saved version then it would do the action you code into it.

    Never played with FB fan pages, so can't say 100% it would work, may be worth a look....infact I might go have a look to make sure that I am not talking out of my ass!!

    FB
     
  5. thepior

    thepior Newbie

    Joined:
    Dec 13, 2009
    Messages:
    21
    Likes Received:
    1
    you can use the rss of the page, make a cron job that check the feed every 15 minutes for example if the feed is updated the script take action
     
  6. fatboy

    fatboy Elite Member

    Joined:
    Aug 13, 2008
    Messages:
    1,618
    Likes Received:
    3,227
    Occupation:
    Retired
    Location:
    Old Peoples Home
    Also, by comment, do you mean someone posting to the wall?
     
  7. milton

    milton Regular Member

    Joined:
    May 21, 2010
    Messages:
    271
    Likes Received:
    60
    There's RSS of Facebook fan pages?

    One problem with this method is I need it to act within a few minutes of the Facebook posting happening

    So if I do I scraper, I would have to scraper continuously, non-stop
     
  8. fatboy

    fatboy Elite Member

    Joined:
    Aug 13, 2008
    Messages:
    1,618
    Likes Received:
    3,227
    Occupation:
    Retired
    Location:
    Old Peoples Home
    If you do the scraper you would have to scrape every so often, the same you would have to do for cron jobs.
     
  9. milton

    milton Regular Member

    Joined:
    May 21, 2010
    Messages:
    271
    Likes Received:
    60
    If Facebook fan pages has an RSS feed page, I think that might be better, I don't know if you can scrape and get the same results?
     
  10. Peter Shaw

    Peter Shaw BANNED BANNED

    Joined:
    Sep 1, 2009
    Messages:
    902
    Likes Received:
    359
    I meant when someone posts to the wall it is a change, where as the only change he wants to monitor is the status update?
     
  11. thebleh

    thebleh Registered Member

    Joined:
    Nov 23, 2008
    Messages:
    85
    Likes Received:
    14
    a crontab script could do this. I don't know if pages have rss feeds, but maybe they do. i think it only does it with notifications

    otherwise, you have to screen scrape which is harder.
     
  12. thepior

    thepior Newbie

    Joined:
    Dec 13, 2009
    Messages:
    21
    Likes Received:
    1
    All facebook pages have rss, with curl you get the feed and you compare with the last one if the feed is different your script take action, as simple as that. If you need realtime update I sugest you make your script run every minute and you should use a good list of proxies with curl so that facebook will not ban your ip adress, you should use a random ip each time the script access facebook. But if you get the feed every minute you could be banned by your host.
     
  13. Grizzy

    Grizzy Senior Member

    Joined:
    Nov 11, 2008
    Messages:
    919
    Likes Received:
    999
    If anyone is wondering, you can get the feed of a fanpage with:
    Code:
    http://www.facebook.com/feeds/page.php?format=atom10&id=xxxxxxxx
    Obviously you don't want to use your hostgator baby plan for any intensive scraping.. just use a machine (virtual if you want) on your lan.
     
    • Thanks Thanks x 1
  14. milton

    milton Regular Member

    Joined:
    May 21, 2010
    Messages:
    271
    Likes Received:
    60
    Awesome, Thanks

    Do all pages have numbered IDs? One page I'm looking at just has a name and no number
     
  15. Grizzy

    Grizzy Senior Member

    Joined:
    Nov 11, 2008
    Messages:
    919
    Likes Received:
    999
    Yea, they all have ids. Take a peak at the source code to find it. Look for:
    Code:
    <link rel="alternate" type="application/rss+xml" title="page title" href="/feeds/page.php?format=atom10&id=xxxxxx"/>
    
     
  16. milton

    milton Regular Member

    Joined:
    May 21, 2010
    Messages:
    271
    Likes Received:
    60
    Thanks, when I go to it to check out the feed, I get smething like "The website declined to show this webpage" or "Unauthorized"
     
  17. Money Man

    Money Man Elite Member

    Joined:
    Apr 2, 2009
    Messages:
    1,698
    Likes Received:
    751
    Occupation:
    Internet Marketer, Advertisement, Programmer, SEO
    I have never done this before but I am 99.99% sure it can be done. As Grizzy said, you do not want to use any shared hosting such as HostGator. However, you do want to have the script scrape the page very often (every 30 seconds or 1 minute, depending on how popular/viral the fan page is).

    Also, when you scrape the page, if you are going to actually be logged into FB when doing so, I wouldn't recommend random IPs as you will hit a roadblock very quickly. I suggest scraping the page without being logged into FB to avoid this.

    My suggestion would be to post a job on Rent A Coder.
     
  18. milton

    milton Regular Member

    Joined:
    May 21, 2010
    Messages:
    271
    Likes Received:
    60
    Thanks, for some reason I can't access the feed on Facebook it says "unathorized" or "unable to connect"

    Its a very popular page and usually people post within the first few minutes, but I found out that they post on their website first before posting on Facebook

    So if their website RSS feed is quick enough, I can scan it, then once I get a scan showing that its updated (they usually updated the Facebook page within a minute or two), I can then have the script activate to search the Facebook Fan page feed and scan every 15-30 seconds for 5-10 minutes until it gets updated, then work that way

    Also, I think I might just buy a crappy laptop and just have it always run, I have a pretty unique wireless situation
     
  19. Money Man

    Money Man Elite Member

    Joined:
    Apr 2, 2009
    Messages:
    1,698
    Likes Received:
    751
    Occupation:
    Internet Marketer, Advertisement, Programmer, SEO
    If you are going to be working off of a laptop you are going to need to install PHP/cURL on your operating system. Also, you better have amazing specs.

    I do not suggest this. I suggest you purchase either a Virtual Private Server or a Dedicated Server. I would personally go with a dedicated server.