benhowdle89
benhowdle89

Reputation: 37464

Notify Google of sitemap change when any content on website changes

I've used Wordpress's plugin that notifies a few search engines every time you make a new post. However i'm thinking of developing a website that users submit stuff to, how can i use PHP to notify Google with an XML sitemap (or similar method) of the site changes as and when they happen, so users submissions are searchable/indexed quickly by Google.

Upvotes: 1

Views: 3779

Answers (4)

Pedro Lobito
Pedro Lobito

Reputation: 98901

For PHP:

file_get_contents("https://www.google.com/webmasters/sitemaps/ping?sitemap=https://domain.tld/sitemap.xml")

For Python:

import requests
requests.get("https://www.google.com/webmasters/sitemaps/ping?sitemap=https://domain.tld/sitemap.xml")

Upvotes: 0

K. V. Suresh
K. V. Suresh

Reputation: 957

Issue your request to the following URL: www.google.com/webmasters/tools/ping?sitemap=sitemap_url Issue the HTTP request using wget, curl, or another mechanism of your choosing. A successful request will return an HTTP 200 response code, if you receive a different response, you should resubmit your request.

Upvotes: -1

Andre Glegg
Andre Glegg

Reputation: 1

shell_exec('ping -c1 www.google.com/webmasters/sitemaps/ping?sitemap=http://www.website.com/sitemap.php');

Upvotes: -1

Related Questions