Helpful Information
 
 
Category: Development Articles
Google API w/PHP

Came across this article - http://www.devshed.com/Server_Side/PHP/GoogleAPI/page3.html on DevShed about using the Google Web APIs with PHP.

I've never worked with OOP/classes in PHP so I'm having a hard time troubleshooting. The problem is that the search request always returns the same set of results. Checking the value of $params[q] throughout the code listed in the article produces the correct query term so I'm assuming that my problem lies in nusoap.php. It appears that the URL of my post is what is actually being delivered to Google by the nusoap class as the query term.

To see the problem in action, go to - http://www.vincemease.com/postnuke/modules.php?op=modload&name=News&file=article&sid=307&mode=thread&order=0&thold=-1 and scroll down to the bottom. The value that I'm setting for 'q' in the DevShed code is '$preformat[title]' from Postnuke. Hardcoding a search term for 'q' works as expected. Why does this choke when given a variable?

Any ideas?

Thanks,
Vince

What version of PHP are you using?

If you are using an older version of PHP, you may need to toggle the behaviour of the "register_globals" variable, which controls the manner in which variables are sent between forms. This could explain why you are having no problems when you hardwire the query string, but are unable to get results when the query is a form variable.

The version of PHP I'm running is 4.3.1, and register_globals is on.










privacy (GDPR)