This give me some totally unrelated number :)
I wanted the current price and it looks like this is just giving me the last
number on the page....

Thanks for your effort tho.. you really didn't need to go to all that
trouble for me :)

-David

-----Original Message-----
From: Iain Wade [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 07, 1999 8:35 PM
To: [EMAIL PROTECTED]
Subject: Re: perl script has problems (kinda OT)

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";


-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to