Sitmap Submission For: Google,Yahoo,Ask & MSN (PHP SOURCE)

Discussion in 'Google Sitemaps' started by imvain2, Feb 14, 2008.

  1. #1
    Since this fits into multiple categories (because its for 4 different search engines and its in PHP) I wasn't sure where the correct place to post. So I'm posting it here, if this is the wrong spot please move it and I apologize.

    This simple PHP code takes the variable $sitemapurl which is the full url of your sitemaps.org and "PINGS" (submits) to Google, Yahoo, MSN and ASK.com. Yes I know technically its not a ping persay, however as this is concerned it doesn't matter.

    Using this code can't guarantee that you will be added to the search engines, or your website listings will be updated. However, this just makes the process easier.

    As google is concerned some recommend creating an account with google webmaster tools instead.

    
            $sitemapurl = "http://$thisdomain/sitemap.xml";
            $Yahoo = "http://search.yahooapis.com/SiteExplorerService/V1/ping?sitemap=" . $sitemapurl;
            $MSN = "http://webmaster.live.com/ping.aspx?siteMap=" . $sitemapurl;
            $ASK = "http://submissions.ask.com/ping?sitemap=" . $sitemapurl;
            $Google = "http://www.google.com/webmasters/sitemaps/ping?sitemap=" . $sitemapurl;
            $GoogleResponse = file_get_contents($Google);
            $MSNResponse = file_get_contents($MSN);
            $YahooResponse = file_get_contents($Yahoo);
            $ASKResponse = file_get_contents($ASK);
            if(strpos($GoogleResponse, "Your Sitemap has been successfully")!==false){
                $GoogleStatus = "Successful";
            }
            else{
                $GoogleStatus = "<b style=\"color:red;\">UnSuccessful</b>";
            }
            if(strpos($MSNResponse, "Thanks for submitting your sitemap")!==false){
                $MSNStatus = "Successful";
            }
            else{
                $MSNStatus = "<b style=\"color:red;\">UnSuccessful</b>";
            }
            if(strpos($YahooResponse, "Update notification has successfully submitted")!==false){
                $YahooStatus = "Successful";
            }
            else{
                $YahooStatus = "<b style=\"color:red;\">UnSuccessful</b>";
            }
            if(strpos($ASKResponse, "Your Sitemap has been successfully received")!==false){
                $ASKStatus = "Successful";
            }
            else{
                $ASKStatus = "<b style=\"color:red;\">UnSuccessful</b>";
            }
            echo "<b>Google's Sitemap submission:</b> " . $GoogleStatus . "<br>";
            echo "<b>Yahoo's Sitemap submission:</b> " . $YahooStatus . "<br>";
            echo "<b>MSN's Sitemap submission:</b> " . $MSNStatus . "<br>";
            echo "<b>ASK's Sitemap submission:</b> " . $ASKStatus . "<br>";
    
    PHP:
     
    imvain2, Feb 14, 2008 IP
    jred2002 likes this.
  2. hibob

    hibob Peon

    Messages:
    211
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Cool thanks.
     
    hibob, Feb 15, 2008 IP
  3. jred2002

    jred2002 Well-Known Member

    Messages:
    160
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #3
    Very helpful - thanks
     
    jred2002, Feb 16, 2008 IP