#!/usr/bin/perl
use strict;
use IO::Socket;
open (PUBTEXT, ">pubtext.txt");
for (my $pubnum = 1; $pubnum < 11; $pubnum++)
{
my $postinfo = "GET /display.php?a=search&state=1&area=1&suburb=0&surrounding=y&type=2&cuisine=0&searchbutton=Search+%BB&feature=0&start=". $pubnum ." HTTP/1.1\n";
$postinfo .= "Accept: */*\n";
$postinfo .= "Accept-Language: en\n";
$postinfo .= "Accept-Encoding: text/*\n";
$postinfo .= "Connection: keep-alive\n";
$postinfo .= "Host: www.westaussie.com\n";
my $sock = new IO::Socket::INET (PeerAddr => 'www.westaussie.com', PeerPort => '80', Proto => 'tcp');
print $sock $postinfo . "\n";
my @data = ();
while ( defined (my $line = <$sock>)) { push(@data,$line); }
for (my $x = 0; $x < scalar(@data); $x++)
{
if (@data[$x] =~ m/> (.*) (.*)<\/strong>
/) {
print "Pub: $1\n";
print PUBTEXT $1 . "|";
if (@data[$x+1] =~ m/ (.*)
/) {
print "Address: $1\n\n";
print PUBTEXT $1 . "\n";
}
}
# print @data[$x];
}
}
close (PUBTEXT);