View Full Version : passing info from field to SE


jlknauff
05-18-2006, 04:39 PM
Can someone point me to an example of a php script to send a querry to a search engine from a form? I want to have someone enter something into a field, and then send several variations of the text entered with no further input from the user. I also need to be able to display data from each set of results.

Is there a tutorial for this action?

Raspberry
05-21-2006, 09:45 PM
I think passing the text from the textfield to a remote page isnt the hard part. But analyzing and parsing the text from the user actually sounds like a lot of code. What sort of variations of text were you looking for? plurals? speeling corrections? alternate word orders?

This is fairly custom, i dont think youll find a tutorial on it.

jlknauff
05-25-2006, 09:49 AM
naa...sending a few queries, putting the results into a db and then monitoring historical trends on it. It will also have graphic output. It's not going to be a 10 minute project ;)

BSolveIT
05-29-2006, 09:38 AM
AJAX is the way to go. The httpRequest object is what you want to look into and experiment with.

The stumbling block for most people though is how to get around the security context of the browser. I've posted a few articles about this in various places - I'm not sure if I mentioned it in this forum somewhere?

Anyway, the way to get around it (so I guess this is something to note for when you get this far in your research) is to use a proxy script on your server. It's very easy indeed, even though it might not seem like it initially.

I could go into more detail, but I'm not 100% sure what your trying to achieve at this point?

Using AJAX though, you can use client (and server) scripting to POST or GET (even PUT) information into remote pages, and retrieve the results in a text stream (responseText). That can include the results pages from any search engine. I've used this for building a keyword tool, and an online rank checker.

However, you need to remember that the search engines don't want you firing automated queries at them. To this end, you could use their API's. I use the Google API (which uses SOAP and XML), Yahoo (it uses REST), and MSN (SOAP and XML). They do (The API's) make the process easier for you and negate the need to do screen scraping. However, they restrict the number of queries you can run in any 24 hour period. Google is the worst at only 100 per day.

So - scraping might well be the way you end up going.

About the proxy script:

When you want the browser to retrieve data from a remote page, just pass the url info to a page on your server which actually retrieves the data, and writes in back in the response. Instead of the response appearing on the screen, it become the responseText in the javascript running on the client. You can then do what you want with it - including parse it, display it, or even call other server scripts to write it to your database. The power and options are limitless.

Also, you can achieve synchronous, or asynchronous script. The choice is actually yours - and very easily too.

Here's a good starting URL for research:

http://swik.net/Ajax

I'm an ASP developer, so I'm afraid I can't help with the PHP, but let me know if you need help with the AJAX Javascript. It's easy once you start to get into it though.

Have fun. :D

jlknauff
05-29-2006, 11:21 AM
Are you strong w/ ajax?

BSolveIT
05-29-2006, 04:02 PM
Yes - quite strong. It's not complicated though. If you can use Javascript, you'll have no problems. I should be able to help with almost anything though.

ditecom
06-12-2006, 10:05 AM
I thought I was slick enough to hide my spam links in this post, but it looks like I smoked a little too much crack and drank a little too much grain alcohol today.

I'll bet I get a title upgrade in a few seconds...