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 qwstandard);
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 = " $cgi="/bookplace/results.asp?SEARCH_FIELD=KEYWORD&TAG=BYWN1X9987X91936
6UPV7K&CID=&SEARCH_TEXT=". "$query" . "&FORM_OB=%24RANK";
$request = HTTP::Request-> new();
$request-> method("GET"
$request-> uri($server.$cgi);
$response = $ua-> request($request);
$item_start = "<!-- ISBN:1";
$item_end = "<!-- ISBN:2";
htmlResults($response, $item_start, $item_end);
}
sub bol()
{
$server = " $cgi="/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="."$query";
$request = HTTP::Request-> new();
$request-> method("POST"
$request-> uri($server.$cgi);
$response = $ua-> request($request);
$item_start = "<b>Suggestions";
$item_end = "this title";
htmlResults($response, $item_start, $item_end);
}
sub htmlResults()
{
if($response->content=~ /$item_start(.*)$item_end/s)
{
print $1;
$counter = 1;
}
print "\t\t</FONT>\n";
print "\t</TD>\n";
print "</TR>\n";
print "</TABLE>\n\n";
print "</body></html>";
}
initialise();
===========================================
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 qwstandard);
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 = " $cgi="/bookplace/results.asp?SEARCH_FIELD=KEYWORD&TAG=BYWN1X9987X91936
6UPV7K&CID=&SEARCH_TEXT=". "$query" . "&FORM_OB=%24RANK";
$request = HTTP::Request-> new();
$request-> method("GET"
$request-> uri($server.$cgi);
$response = $ua-> request($request);
$item_start = "<!-- ISBN:1";
$item_end = "<!-- ISBN:2";
htmlResults($response, $item_start, $item_end);
}
sub bol()
{
$server = " $cgi="/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="."$query";
$request = HTTP::Request-> new();
$request-> method("POST"
$request-> uri($server.$cgi);
$response = $ua-> request($request);
$item_start = "<b>Suggestions";
$item_end = "this title";
htmlResults($response, $item_start, $item_end);
}
sub htmlResults()
{
if($response->content=~ /$item_start(.*)$item_end/s)
{
print $1;
$counter = 1;
}
print "\t\t</FONT>\n";
print "\t</TD>\n";
print "</TR>\n";
print "</TABLE>\n\n";
print "</body></html>";
}
initialise();
===========================================