Script to automatically submit your sitemap to Google, Bing, Yahoo, Ask, etc…

The other day I made a post with example code to create a Google based Sitemap.  In today’s post I am going to write a quick little function to show you how to submit your Sitemap to engines such as Google, Bing / MSN, Ask, etc.

Each of these major search engines has a Sitemap submission service.  Both Google and Bing have great webmaster tools where you can get information on your submitted sitemaps, along with general indexing stats.  I highly recommend signing up for these services so that you can track and monitor your sitemap submissions.  You can also be alerted to errors with your sitemap as well.

In this example we are going to use a simple cUrl process in PHP to ping the Google, Bing/MSN and Ask search Engine Sitemap submission urls.  Yahoo is not included in the list because back in 2012 they shut down the submission service and have been utilizing MSN’s services.

The only thing you need to do is set the full absolute path to your Sitemap in the variable below.  I set it to my sample file at :


* Sitemap Submitter
* Use this script to submit your site maps automatically to Google, Bing.MSN and Ask
* Trigger this script on a schedule of your choosing or after your site map gets updated.

//Set this to be your site map URL
$sitemapUrl = "";

// cUrl handler to ping the Sitemap submission URLs for Search Engines…
function myCurl($url){
  $ch = curl_init($url);
  curl_setopt($ch, CURLOPT_HEADER, 0);
  $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  return $httpCode;

$url = "".$sitemapUrl;
$returnCode = myCurl($url);
echo "<p>Google Sitemaps has been pinged (return code: $returnCode).</p>";

//Bing / MSN
$url = "".$sitemapUrl;
$returnCode = myCurl($url);
echo "<p>Bing / MSN Sitemaps has been pinged (return code: $returnCode).</p>";

$url = "".$sitemapUrl;
$returnCode = myCurl($url);
echo "<p> Sitemaps has been pinged (return code: $returnCode).</p>";


I hope that was helpful!

Posted in , and tagged , , , , .