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

milton

Regular Member
Joined
May 21, 2010
Messages
271
Reaction score
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?
 
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......
 
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......

But if the page has more comment since, its going to make an action?
 
But if the page has more comment since, its going to make an action?

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
 
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
 
Also, by comment, do you mean someone posting to the wall?
 
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
 
If you do the scraper you would have to scrape every so often, the same you would have to do for cron jobs.
 
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?
 
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.
 
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.
 
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

But if you get the feed every minute you could be banned by your host.
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.
 
Awesome, Thanks

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

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"/>
 
Thanks, when I go to it to check out the feed, I get smething like "The website declined to show this webpage" or "Unauthorized"
 
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.
 
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
 
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

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.
 
Back
Top