Hi,

Would someone please help me diagnose what is wrong with this PHP code
to add a new "housing" item to Google Base?

Background:
I took code to post a "recipe" and was successfully able to post.
Modifying the code for  housing causes "namespace" error, but I don't
see any settings for namespace. I've included what I believe are the
"required" attributes.

I just want the absolute minimum code needed to post a new housing
item to Google Base.

Thank you in advance.

<?php
// load Zend Gdata libraries
$clientLibraryPath = 'ZendGdata/library';
$oldPath = set_include_path(get_include_path() . PATH_SEPARATOR .
$clientLibraryPath);
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_Gbase');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');

// set credentials for ClientLogin authentication
$user = "[email protected]";
$pass = "secret";
define('DRY_RUN', TRUE);

try {
  // perform login
  // initialize service object
  $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass,
'gbase');
  $service = new Zend_Gdata_Gbase($client);

  // initialize new item
  // set title, content and type
  $item = $service->newItemEntry();
  $item->setItemType('housing');
  $item->title = new Zend_Gdata_App_Extension_Title('123 Main
Street');
  $item->content = new Zend_Gdata_App_Extension_Content('This is some
text');

  // set type attributes
  $item->addGbaseAttribute('description', 'A wonderful house.',
'text');
  $item->addGbaseAttribute('price', '450000', 'number');
  $item->addGbaseAttribute('location', '2100 S. Bascom Avenue, San
Jose, CA, 95008, US', 'location');
  $item->addGbaseAttribute('link', 'http://www.example.com', 'text');
  $item->addGbaseAttribute('listing type', 'for sale', 'text');

  // save to server
  $entry = $service->insertGbaseItem($item, DRY_RUN);

  // display success message
  echo "Entry added successfully with ID: " . $entry->getId();
} catch (Exception $e) {
  die('ERROR:' . $e->getMessage());
}
?>

-- 
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