Forum Moderators: coopster
I am a beginner, needlessly hardheaded programmer. I have been working on this Google API for months with minimal success. I am about to lose my mind, so I figured I'd see about some help.
I am trying to build a form and php server script to access Google Base.
The code example for the form I have is:
<html><body>
<h4>Form</h4>
<form action="snippet.php" method="GET">
<p>Listing Type:
<input name="listing_type" type="text" />
</p>
<p>Location:
<input name="location" type="text" />
<input type="submit" />
</p>
</form>
</body></html>
The script code is below:
<?php
require_once 'Zend/Loader.php'; // this should point to your Zend lib installation
Zend_Loader::loadClass('Zend_Gdata_Gbase');
$service = new Zend_Gdata_Gbase();
$query = $service->newSnippetQuery();
$query->setCategory('housing');
$query->getBq('listing_type:', 'location: ');
$query->setMaxResults('10');
$feed = $service->getGbaseSnippetFeed($query);
foreach ($feed as $entry) {
// using the magic accessor
echo 'Title: ' . $entry->title->text;
// using the defined accessors
echo 'Content: ' . $entry->getContent()->getText();
}
?>
The GET URL that is displayed in the browser is:
http://example.com/snippet.php?listing_type=for+sale+&location=philadelphia%2C+pa
What I am attempting to do is to get the listing type & location categories from the GET URL into the
$query->getBq('listing_type:', 'location: ');
section of the script.
If anyone can help me do this it would be absolutely fantastic!
Thanks!
[edited by: dreamcatcher at 6:27 am (utc) on Sep. 10, 2008]
[edit reason] use example.com. Thanks. [/edit]
And Welcome to WebmasterWorld! :)