Discover the best of the web!
Learn more about Digg by taking the tour.
Ping Your Blog Automatically, Using This Perl Script
johnbokma.com — The following Perl program pings your blog to several online update services. This can be scripted to run routinely (e.g. cron job).
- 300 diggs
- digg it
- damianglass, on 10/12/2007, -16/+2GREAT! thats what i was waiting for I am sure it will to make my blog more popular
- DarkHorizon5, on 10/12/2007, -2/+15Pong
- grablife, on 10/12/2007, -2/+8Does not apply if you're using Wordpress. It already does it.
- digitallysick, on 10/12/2007, -2/+9err umm why would i want to ping my blog?
- meig, on 10/12/2007, -0/+4If you use sites like Technorati you have to have it ping your blog so it knows that you updated.
- raccettura, on 10/12/2007, -1/+8Um, this isn't necessary for many reasons:
1. Only needs to be pinged when blog is updated... otherwise your just spamming and may be blocked.
2. All popular blog products do this automatically. WordPress for example uses Automattic's http://pingomatic.com/ which pings several providers for you.
Buried this one... it's either spam, inaccurate or lame... most likely a combo of the 3.- ChiliJ, on 10/12/2007, -3/+2If you don't digg it, then don't. Some people might find it interesting or educational. Burying it simply because you don't find it necessary is lame.
What is inaccurate about the entry anyway? There is nothing in the description or the linked article that says Wordpress users needs this. - Haplo, on 10/12/2007, -0/+2If you have several blogs that are updated very often, running this script once a day via cron releases some load from those services instead of having WordPress et al ping automatically with each post.
"it's either spam, inaccurate or lame"
I blocked you, since you are clearly lame :-) - hman2, on 10/12/2007, -0/+2I run TextPattern which doesn't ping any services at all, unfortunately, so this script is really useful for me, as I can just set it up to run daily which isn't spamming at all in my opinion.
- ChiliJ, on 10/12/2007, -3/+2If you don't digg it, then don't. Some people might find it interesting or educational. Burying it simply because you don't find it necessary is lame.
- crizpiz2, on 10/12/2007, -4/+1Heheh, 'ping' "your" blog.. or ddos someone else's ;)
- nthitz, on 10/12/2007, -0/+3Yea, not at all. Your not really pinging your blog, you are pinging services that keep track of blogs such as technorati. Your blog will not be pinged by this script.
- noreturn, on 10/12/2007, -1/+0Out of curiousity, which blogging services/suites don't already do this?
- warble, on 10/12/2007, -0/+2Well, the one I wrote for my site for example.. although I'm going to rewrite this in PHP..
- Haplo, on 10/12/2007, -0/+2My own blogging software for example. And I am sure I am not the only one. Another reason for this script I explained a bit more up. If you update several times a day your blog, you can ping once a day via cron instead of pinging for each minor update.
- gnuvince, on 10/12/2007, -0/+2The code is pretty nice, very readable. Still wondering why he didn't use a hash though...
- Haplo, on 10/12/2007, -0/+1Thanks for the compliment on the code. I did use a hash originally, then dropped it and replaced it for refs to array, which originally also contained the method call (there are two ping methods). I had a look again at the code, and probably a hash is indeed a more readable solution, will fix it, thanks.
- Haplo, on 10/12/2007, -0/+1Ok, thanks gnuvince, I decided to stick with the array, since one can specify the order of pings that way :-). But thanks to you I found another way more annoying bug: I mixed up $name in the method call: I used the service name, not the name as specified at the command line. Bad mistake :-(. Fixed, thanks.
- BierBaron, on 10/12/2007, -0/+1Haplo:
Check Tie::IxHash or Tie::IxHash::Easy. These modules will allow you to save the order of your hash keys. - Haplo, on 10/12/2007, -0/+1Hi BierBaron,
I am aware of those Tie modules to create an ordered hash, but I think the code is clear enough as it is, and not that complicated. The only saver would IMO be the [ ] on each line, which I could get rid of using splice as well, e.g.
my @services = (
'service' => 'url',
'service' => 'url',
....
)
while ( my ( $service_name, $service_url ) = splice @services, 0, 2 ) {
etc...
}
- moonwell, on 10/12/2007, -1/+1Delete your blog automatically, Using rm -rf, and saving time
- noyp, on 10/12/2007, -0/+0several folks who don't code and are newbs asked how to use the code on their site/blog?
Do i paste it on the index page?- Haplo, on 10/12/2007, -0/+1Hi noyp,
No, you paste it in a text file, and call this one rpcping.pl
If you don't have shell access on your server, you might want to run this on your home computer. Assuming you have Windows XP you install ActivePerl, and create a Scheduled Task (via Control Panel) to run the script, say, daily.
- Haplo, on 10/12/2007, -0/+1Hi noyp,
- pixelbeat_, on 10/12/2007, -0/+3one can use wget (and pingomatic) to do this more simply.
I generate my feed with a simple shell script:
http://www.pixelbeat.org/docs/web/feed.html
After I run the above script I do something like this to tell everyone about it:
wget --quiet "http://pingomatic.com/ping/?title=the+latest+from+$site&blogurl=http://$site/&rssurl=http://$site/feed/rss2.xml&"
"chk_weblogs=on&"
"chk_technorati=on&"
"chk_blogs=on&"
"chk_feedburner=on&"
"chk_syndic8=on&"
"chk_newsgator=on&"
"chk_feedster=on&"
"chk_myyahoo=on&"
"chk_pubsubcom=on&"
"chk_blogdigger=on&"
"chk_blogstreet=on&"
"chk_moreover=on&"
"chk_weblogalot=on&"
"chk_icerocket=on&"
"chk_newsisfree=on&"
"chk_topicexchange=on"
-O- >/dev/null- Haplo, on 10/12/2007, -0/+1The reasons for me to write the script were:
- educational, I did my best to write very clear code (I will write a more complete explanation over time on how it exactly works) and try to learn from it
- extendable, with pingomatic and friends one depends on what they consider good services. I have nothing against pingomatic, mind, but it might be that one needs services not listed.
- code reuse, one can use this in his/her own code as part of the code.
- Haplo, on 10/12/2007, -0/+1The reasons for me to write the script were:
