Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do i fetch results from www.bol.com? so many hidden fields!

Status
Not open for further replies.

karmafree

Programmer
May 10, 2001
107
GB
hi, i am trying to write a cgi script that will allow me to compare the book prices at bookplace.co.uk and bol.com (united kingdom).
i got bookplace.co.uk working after posting a massive url but i cant get bol working. what is the url i need?

for $cgi="".........?

my code is as follows
==============================================
#!/usr/local/bin/perl
use CGI qw:)standard);
use LWP::UserAgent;
use CGI::Carp qw(fatalsToBrowser);

sub initialise()
{
$query=param('txtQuery');
$ua = LWP::UserAgent-> new();
$ua-> agent("AgentName/0.1 " . $ua-> agent);
htmlBody();
}

sub htmlBody()
{
print "Content-Type: text/html\n\n";
print <<HTMLhead;
<HTML>
<HEAD>
<TITLE>Results</TITLE>
</HEAD>
<BODY BGCOLOR='#FFFFFF'>

<TABLE BORDER='0' CELLPADDING='0' CELLSPCAING='0' ALIGN='CENTER'>
<TR>
<TD>
<FONT FACE='Verdana' SIZE='2' COLOR='#000000'>
HTMLhead
;

bookplace();
bol();
}

sub bookplace()
{
$server = &quot; $cgi=&quot;/bookplace/results.asp?SEARCH_FIELD=KEYWORD&TAG=BYWN1X9987X91936
6UPV7K&CID=&SEARCH_TEXT=&quot;. &quot;$query&quot; . &quot;&FORM_OB=%24RANK&quot;;
$request = HTTP::Request-> new();
$request-> method(&quot;GET&quot;);
$request-> uri($server.$cgi);
$response = $ua-> request($request);
$item_start = &quot;<!-- ISBN:1&quot;;
$item_end = &quot;<!-- ISBN:2&quot;;
htmlResults($response, $item_start, $item_end);
}

sub bol()
{
$server = &quot; $cgi=&quot;/cec/cstage?ecaction=prodsearch&prdTmp=src_mainresults_top.uk.htm&startn
um=1&count=0&product_type=0&query_type=QUICK&eccookie=&table
_type=A¤t_step=1&quick_type=title&quick_text_ent=&quot;.&quot;$query&quot;;
$request = HTTP::Request-> new();
$request-> method(&quot;POST&quot;);
$request-> uri($server.$cgi);
$response = $ua-> request($request);
$item_start = &quot;<b>Suggestions&quot;;
$item_end = &quot;this title&quot;;
htmlResults($response, $item_start, $item_end);

}


sub htmlResults()
{


if($response->content=~ /$item_start(.*)$item_end/s)
{
print $1;
$counter = 1;
}
print &quot;\t\t</FONT>\n&quot;;
print &quot;\t</TD>\n&quot;;
print &quot;</TR>\n&quot;;
print &quot;</TABLE>\n\n&quot;;
print &quot;</body></html>&quot;;
}


initialise();

===========================================
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top