Celebird, your solution worked -- Thank you very much!
The documentation says bedrooms and bathrooms are not required so I
tried it without specifying them and it worked. So, for everyone's
reference, here is the final code which worked:
<?php
// load Zend Gdata libraries
$clientLibraryPath = 'ZendGdata/library'; // specify the full path to
your library file
$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); // set to TRUE for testing, FALSE to
actually insert the item
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'); // this will display under "Description"
// set type attributes
$item->addGbaseAttribute('price', '450000', 'number');
$item->addGbaseAttribute('location', '2110 S Bascom Avenue,
Campbell, CA, 95008, US', 'location'); // map will show this address
$item->addGbaseAttribute('listing_type', 'for sale', 'text');
#
$alink = $item->link;
$alink[] = $service->newLink('http://www.example.com/
my_page.htm','alternate', 'text/html');
$item->link = $alink;
#
// 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.