views:

24

answers:

1

Right, so basically I need to query a selection of search engines in an AJAX app. As there is a number of different search engines - there's no search engine specific API I can use either. My main problem is getting the number of results returned by the search.

So far, I have decided it is probably best to use a regexp from the returned search query HTML, and then convert the string of characters to an integer. However, this method just doesn't feel.. clean to me. It seems a bit rough around the edges and I think it could do with improving! I guess not being 100% confident with regular expressions doesn't help; but it just feels like it could be improved.

Any ideas on how to implement this would be great cheers! It doesn't seem like that an exotic thing to do, so I was wondering if perhaps any of you guys have done this before and would have a few tips?

Note: This is an AJAX app at the moment, but I may be re-writing this functionality in a different app soon - which won't be AJAX. I'm confident I can transfer any AJAX implementation to the other language though.

A: 

I would write a local script to do the request & parsing from the search engine(s) and then return only the information you want. Point your AJAX request at this local resource.

Sugerman