My New Photo Site has approximately 475 albums. Each album has manually coded RSS feeds. Now submitting that much RSS feeds, one by one, into Google Webmaster Tool’s interface is quiet painful.

So, I digged into Google’s GDATA API Code provided by Zend Framework. It’s very easy to submit google sitemap using php coding.

(1) Download Zend FrameWork
(2) Download GData API
(3) Write the code written @ end of the post into your php file & save it on path /demos/Zend/Gdata & run it.

Google needs RDF data tobe submitted to using POST request.

RDF format for submitting sitemaps is,

<atom:category scheme=''

You need to change with your sitemap location dynamically using php.

Above XML was creating some parsing errors before submitting POST request because it has no name-space.

So, I googled some different xml for submitting SiteMap,

<entry xmlns="" xmlns:wt="">
<category scheme='' term=''/>

So final php code became.


require_once 'Zend/Loader.php';

// Provide Google Account Information
$email = '';
$passwd = 'xxxxxxxx';
$service      = 'sitemaps';

// Try to connect
try {
$client = Zend_Gdata_ClientLogin::getHttpClient($email, $passwd, $service);
} catch (Zend_Gdata_App_CaptchaRequiredException $cre) {
echo 'URL of CAPTCHA image: ' . $cre->getCaptchaUrl() . "n";
echo 'Token ID: ' . $cre->getCaptchaToken() . "n";
} catch (Zend_Gdata_App_AuthException $ae) {
echo 'Problem authenticating: ' . $ae->exception() . "n";


function add_sitemap($sitemap-location,$client){
$xml ='<entry xmlns="" xmlns:wt=""><id>'.$sitemap-location.'</id>';
$xml.="<category scheme='' term=''/><wt:sitemap-type>WEB</wt:sitemap-type></entry>";
$fdata = new Zend_Gdata($client);