Hi All,

I am trying to execute the below code to insert a sample product into
the google base using php.
<?php

require_once 'Zend/Loader.php';
echo("gerger");
Zend_Loader::loadClass('Zend_Http_Client');
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_Query');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_App_Extension_Element');

echo("Hi");
function addBaseAttribute($name, $value, $entry) {
  $array = $entry->getExtensionElements();
  $new_extension = new Zend_Gdata_App_Extension_Element($name, 'g',
'http://base.google.com/ns/1.0', $value);
  $array[count($array)] = $new_extension;
  $entry->setExtensionElements($array);
}

$user = '[EMAIL PROTECTED]';
$pass = 'replace';
echo($user);
$httpClient = Zend_Gdata_ClientLogin::getHttpClient($user, $pass,
'gbase');
echo("Hello");
$gdClient = new Zend_Gdata($httpClient);

$entry = $gdClient->newEntry();
$entry->title = $gdClient->newTitle(trim('My computer'));
$entry->content = $gdClient->newContent(trim('It is new and
improved.'));
$entry->content->setType('text');
addBaseAttribute('item_type', 'products', $entry);

$createdItem = $gdClient->insertEntry($entry, 'http://www.google.com/
base/feeds/items?dry-run=true');

print 'Created: ';
print $createdItem->title->text;
print '<br/>Created Id: ';
print $createdItem->id->text;

?>

When i trird to run th.is program, i could get nothing but a page can
not be displayed page.
$httpClient = Zend_Gdata_ClientLogin::getHttpClient($user, $pass,
'gbase');
echo("Hello");
When i tried to print something before authentication, i am able to
get it print on the screen but i could not be able to print anything
after the authentication statement. From this i understand that there
is a problem with this line.

$httpClient = Zend_Gdata_ClientLogin::getHttpClient($user, $pass,
'gbase');

Can anybody please tell me what is the problem and how can i resolve
it?

Thanks,
Waiting for your reply.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Base Data API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Base-data-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to