Operating System - HP-UX
1826123 Members
5271 Online
109690 Solutions
New Discussion

HWP stock price from perl script

 
SOLVED
Go to solution
Bill McNAMARA_1
Honored Contributor

HWP stock price from perl script

Hi all,

I need a perl function to get simply the numerical value of HP stock price for inserting into a cgi script..

As my perl is lousy, can anyone help me on this!

ie: must return plain text numerical value. Nothing else.

Thanks!
Bill

It works for me (tm)
2 REPLIES 2
Olav Baadsvik
Esteemed Contributor

Re: HWP stock price from perl script



Hi,

I know nothing about perl, but if it is
the HWP you want you may put in a
constant with the value 17,44
The reason is that from may 7 I think it
was, the tickername was changed to HPQ.

The current value is 15.10 and this
will be correct for still a few hours.
So put this in as the value also and
add 1 to it every 7 days and I will be
happy.

Regards
Olav
Gregory Fruth
Esteemed Contributor
Solution

Re: HWP stock price from perl script

Have a look at xquote (http://sunsite.dk/xinvest/xquote.html).

Xquote looks up stock quotes using HTTP.
Just peek at the protocol it's using and
then replicate it using Perl's LWP::UserAgent
and HTTP::Request modules. It should be
something like:

use LWP::UserAgent;
use HTTP::Request;

$ua = new LWP::UserAgent;
$ua->agent("myQuoteThing/1.0");
$req = new HTTP::Request(GET =>
'http://someserver.someplace.com/getquote?symbol=HPQ');
$res = $ua->request($req);
print $res->content();

You have to figure out what to put in the GET field; I
dunno what server to use, nor do I know the exact
syntax of the request. Looking at the Xquote source
code ought to help.

Good luck!