How to submit sitemaps to Google / Yahoo on posting?

Google Sitemap HTTP Ping

This post talks about how to submit site map of your blog/site automatically to Google/Yahoo on posting the content every time. The normal process is to submit your sitemap in Google Webmaster tools, but the shortcoming is that Google picks the site maps on regular interval once in a day or so, but If you are updating content several times within a day then you might need to submit/update your sitemaps every time.

The process of sending sitemap updates to Google / Yahoo / other search engines is called HTTP Ping for sitemaps.

For Google below is the process of sitemap HTTP ping.

Build the following url say if
your website name is : http://www.mysite.com and

your sitemap url is http://www.mysite.com/sitemap.xml then the following is the url you need to build for sitemap

www.google.com/webmasters/tools/ping?sitemap=http://www.mysite.com/sitemap.xml

Since we are sending the GET request we need to do a URLEncode of  the your sitemap url.

This can be achieved through following method UrlEncode  in PHP and Encode in Java or you can use free encoders available online to encode the sitemp url one time.

When I did encode of the above http://www.mysite.com/sitemap.xml  this is what I got    

So our final url is

www.google.com/webmasters/tools/ping?sitemap=http%3A%2F%2Fwww.mysite.com%2Fsitemap.xml

send the request using wget or curl or any class of your choice.

If you get back HTTP 200 response then its a success else try it again. Google says you can send updates eevrytime you update/add content to your site  and it can be upto every hour. So this will help you boost the updated nature of your content in Google search engine. 

 

Yahoo Sitemap HTTP ping

Same approach works with Yahoo but in case of yahoo You need to get a App Id  from yahoo services

First Get App Id  =  http://developer.yahoo.com/wsregapp/ 

use the appId in below url as I have mentioned earlier encode your sitemap  url and add it like 

http://search.yahooapis.com/SiteExplorerService/V1/updateNotification?appid=AppId&url=http%3A%2F%2Fwww.mysite.com%2Fsitemap.xml