Skip to content

Pinging tool to let the world know your blog/site has been updated.

Are you familiar with what pinging an aggregator is? If you’re looking for a way to let the world know that your blog or website has been updated there’s something you can do which is called pinging an aggregator ( I’m sure there’s some technical term for it but I don’t know or care what it is. ) which is a website that collects the latest updates on site by notification. Some examples of these places are weblogs.com, technorati, feed burner, etc. Back in the day (sounding like an old man) you could ping these places and the spiders would come running and index you instantly, this was back in 2006. They’re not nearly as effective now but definately still bring the spiders. I’ve been asked numerous times if I would post a script to post to these engines and honestly the easiest way to do it is go through something like pingomatic.com. Which submits the pings to all the engines for you. I may later make a script that uses the xml post to a list of aggregators seperately. But for now to keep it easy lets get started with a simple pinger for pingomatic. This is an EXTREMELY simple script that if you know how to use curl you could do very easily. However sometimes the hard part is finding out what to post where. Therefore I’m going to touch on using LiveHTTPHeaders to pull the string out.

If you don’t have LiveHTTPHeaders please go to http://livehttpheaders.mozdev.org/ and install it now. I’m also going to assume you’re using FireFox as any self respecting dev should be. The first thing once you have LHH installed is go to “Tools” in firefox and then down to “Live Http Headers” and open the headers window. Next go to http://www.pingomatic.com in firefox. You’ll probably see a bunch of stuff fly by on the window as that’s the headers being passed and received to get to that page. Now you’ll want to hit clear and clean that out so the box is blank for LHH. Next fill in your values on the form on pingomatic.com, once you’re done hit “send pings”. Again you’ll see some info in the headers box that looks like this.

http://pingomatic.com/ping/?title=Oooff.com&blogurl=http%3A%2F%2Foooff.com%2Fphp-affiliate-seo-blog%2F&rssurl=http%3A%2F%2Foooff.com%2Fphp-affiliate-seo-blog%2Ffeed&chk_weblogscom=on&chk_blogs=on&chk_technorati=on&chk_feedburner=on&chk_syndic8=on&chk_newsgator=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

GET /ping/?title=Oooff.com&blogurl=http%3A%2F%2Foooff.com%2Fphp-affiliate-seo-blog%2F&rssurl=http%3A%2F%2Foooff.com%2Fphp-affiliate-seo-blog%2Ffeed&chk_weblogscom=on&chk_blogs=on&chk_technorati=on&chk_feedburner=on&chk_syndic8=on&chk_newsgator=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 HTTP/1.1
Host: pingomatic.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12
Accept: application/x-shockwave-flash,text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://pingomatic.com/
Cookie: blogurl=http%3A%2F%2Foooff.com%2Fphp-affiliate-seo-blog%2F; title=Oooff.com; pinged=a%3A13%3A%7Bi%3A0%3Bs%3A14%3A%22chk_weblogscom%22%3Bi%3A1%3Bs%3A9%3A%22chk_blogs%22%3Bi%3A2%3Bs%3A14%3A%22chk_technorati%22%3Bi%3A3%3Bs%3A11%3A%22chk_myyahoo%22%3Bi%3A4%3Bs%3A13%3A%22chk_pubsubcom%22%3Bi%3A5%3Bs%3A14%3A%22chk_blogstreet%22%3Bi%3A6%3Bs%3A14%3A%22chk_feedburner%22%3Bi%3A7%3Bs%3A11%3A%22chk_syndic8%22%3Bi%3A8%3Bs%3A13%3A%22chk_newsgator%22%3Bi%3A9%3Bs%3A14%3A%22chk_blogdigger%22%3Bi%3A10%3Bs%3A12%3A%22chk_moreover%22%3Bi%3A11%3Bs%3A14%3A%22chk_weblogalot%22%3Bi%3A12%3Bs%3A13%3A%22chk_icerocket%22%3B%7D

HTTP/1.x 200 OK
X-Powered-By: PHP/4.4.7
Set-Cookie: blogurl=http%3A%2F%2Foooff.com%2Fphp-affiliate-seo-blog%2F; expires=Mon, 07 Jul 2008 14:41:14 GMT; path=/; domain=.pingomatic.com
Set-Cookie: title=Oooff.com; expires=Mon, 07 Jul 2008 14:41:14 GMT; path=/; domain=.pingomatic.com
Set-Cookie: pinged=a%3A13%3A%7Bi%3A0%3Bs%3A14%3A%22chk_weblogscom%22%3Bi%3A1%3Bs%3A9%3A%22chk_blogs%22%3Bi%3A2%3Bs%3A14%3A%22chk_technorati%22%3Bi%3A3%3Bs%3A11%3A%22chk_myyahoo%22%3Bi%3A4%3Bs%3A13%3A%22chk_pubsubcom%22%3Bi%3A5%3Bs%3A14%3A%22chk_blogstreet%22%3Bi%3A6%3Bs%3A14%3A%22chk_feedburner%22%3Bi%3A7%3Bs%3A11%3A%22chk_syndic8%22%3Bi%3A8%3Bs%3A13%3A%22chk_newsgator%22%3Bi%3A9%3Bs%3A14%3A%22chk_blogdigger%22%3Bi%3A10%3Bs%3A12%3A%22chk_moreover%22%3Bi%3A11%3Bs%3A14%3A%22chk_weblogalot%22%3Bi%3A12%3Bs%3A13%3A%22chk_icerocket%22%3B%7D; expires=Mon, 07 Jul 2008 14:41:14 GMT; path=/; domain=.pingomatic.com
Content-Type: text/html
Content-Length: 2484
Date: Thu, 13 Mar 2008 20:54:40 GMT
Server: LiteSpeed
Connection: close
I’m not going to get into detail on what all that means because in this case we only care about one thing and that’s the very top line. They are using a GET string vs. a post as you can see all the data is be appended to the url. If you don’t know there are two ways to pass data in HTML that’s a GET or POST. GET is going to put all the data in the url. For example look at googles string when you do a search, that’s using GET style data passing. A POST pass is a little more complicated so we’ll save that for the next tutorial. There would be an additional line in the headers that would say post:. With a post we need to add a few more lines to the curl call but we’re not going to do that in this tutorial. Now that we have our url with the data in it lets talk about hwo we’re going to make that into a script to post to the ping.

What I decided to do to make it easier to read is break the string up as you can see we’re using the .= which just keeps appending the string. So you could do this in a single string inline but this is much easier to read. From here I’m going to go to commenting the code for each line.

<?php

// Here is where we're breaking up the url as mentioned above, you can easily see which engines we're pinging now as opposed to trying to find them in the long url
// this is the base url so we're starting our url with that
$url = "http://pingomatic.com/ping/?";
// you'll notice we're using a urlencode function here that makes the text you print url friendly and replaces the chars like spaces with their appropriate url friendly value.
$url .= "title=".urlencode("PHP Posting and Screen Scraping Tutorials");
$url .= "&blogurl=".urlencode("http://oooff.com/php-affiliate-seo-blog/");
$url .= "&rssurl=".("http://oooff.com/php-affiliate-seo-blog/feed");
//as far as I'm concerned leave all the ping places on, the more the better
$url .= "&chk_weblogscom=on";
$url .= "&chk_blogs=on";
$url .= "&chk_technorati=on";
$url .= "&chk_feedburner=on";
$url .= "&chk_syndic8=on";
$url .= "&chk_newsgator=on";
$url .= "&chk_myyahoo=on";
$url .= "&chk_pubsubcom=on";
$url .= "&chk_blogdigger=on";
$url .= "&chk_blogstreet=on";
$url .= "&chk_moreover=on";
$url .= "&chk_weblogalot=on";
$url .= "&chk_icerocket=on";
$url .= "&chk_newsisfree=on";
$url .= "&chk_topicexchange=on";

// now that we have our url composed our url we’re going to call it using curl
// initializes the curl object and sets the url we’re going to get
$ch = curl_init($url);
// tells curl it to follow any redirects
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
// returns the page fetched to a variable in this case $page
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// executes the curl object as we have things set
$page = curl_exec($ch);
// cleans up the curl object nicely
curl_close($ch);
//prints the page got to the screen to make sure it worked right.
echo $page;

?>

A challenge for you, take this script and make it load the data from a csv file which is in the format

title,url,feed
title,url,feed
Here’s a hint there’s another tutorial on this site you can copy that from.

Hope this helps some of you building a simple ping system for your sites and blogs. I might show you a tutorial on how to ping each individually but we’ll see how I feel. Now we wouldn’t want to over ping and abuse this now would we πŸ˜‰

Enjoy!
Smaxor

3 Comments

  1. Cool stuff. Been using one from syndik8 which didnt include feed url, this should be extremely helpful.

  2. By the way, you’ve missed one urlencode in there – for the feedurl.

  3. pingomatic now gives you a url to bookmark which is the one you’re building up in PHP so you can just paste into there and add the cURL params as per the rest of your script.

    No need to use LHH anymore or build up that big long string.

Comments are closed.