David,

The page isn't very structured .. so there's no exact way of doing this, as
I'm sure you're aware; but this one works just as well and is quite a bit
shorter.

(Turn away if you don't want to cheat for school :)







______
!/usr/bin/perl -w
use IO::Socket;
use FileHandle;

my $value;
my $file = FileHandle->new("stocks.txt", O_WRONLY|O_APPEND);
my $sock = IO::Socket::INET->new(
        PeerAddr => "quotes.nasdaq-amex.com",
        PeerPort => "80",
        Proto => "tcp"
) || die "Can't connect to server.\n";

print $sock "GET /quote.dll?page=multi&mode=stock&symbol=MSFT HTTP/1.0\n\n";

while (<$sock>)
{
        $value = $1 if m!<font color="FF0000">(\d*.\d*)</font>!;
}

print $file localtime(). ': '. $value. "\n";

smime.p7s

Reply via email to