On Mon, 15 Jun 2009 14:10:14 +0100, Mimi Cafe <mimic...@googlemail.com>
wrote:

> I am trying to write a small online price comparison-agent, but I have no
> experience doing something similar before. 
> My intention is to query search engines for a product and try to my own
> algorithm to parse the returned values for the prices and compare them.
> 
> Can any experienced developer tell me whether or not this is the right
way
> to proceed? if not, can you tell me how to go about this (also suggest
Perl
> modules which can be used)? I am unsure whether the libwww could be used
> for this.

There are 2 main ways you can go about this. The first is to get access to
the search engines' API. With this, you'll be able to send SOAP requests
and receive nicely structured responses. Depending on the search engine,
they may charge you for access to their API.

The other way, as you've guessed, is to simple send http requests for
various products, and attempt to parse the HTML output. This is messy and
time-consuming, and if the search engine output changes ( it happens ), you
have to revise your code.

> I have spent some time searching the web for an example of comparison
agent
> codes, but found none. It looks like such algorithms are kept secret by
> their owners.

There is no secret to the comparison algorithm. It's a simple sort, based
on price. The secret bit is parsing the HTML output of each search engine.
 
> Please give code examples if possible.

Ha! Sorry. That's highly unlikely. It's quite a specialised task, and
people who have done it will likely be guarding this code.

I wrote some code a while back to parse a webpage. I used LWP::Simple to
fetch the page contents, and HTML::TreeBuilder to parse it.

Dan

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to