Forum Moderators: coopster

Message Too Old, No Replies

Google API Base Search Form

Desperate Fool at The End of His Pitiful Rope

         

rbboova

4:32 am on Sep 10, 2008 (gmt 0)

10+ Year Member



Hello,

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]

eelixduppy

5:14 am on Sep 15, 2008 (gmt 0)



Are you getting any errors from the script? Have you checked out the documentation [code.google.com] for anything relating to your issue? Have you gotten any further with this problem?

And Welcome to WebmasterWorld! :)

rbboova

1:12 pm on Sep 15, 2008 (gmt 0)

10+ Year Member



Thanks for the reply and the welcome.

I figured out the problem. I was using a GET action when I needed to be using a POST action.