Re: Stuck automating login to reuters.com and getting a page

[email protected] (Carl Wells) Sun, 16 Jan 2011 08:38:08 -0800 (PST)
Newsgroups perl.beginners.cgi
Message-ID <[email protected]>
--0-1371451045-1295195888=:7251
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Thanks Mike.=A0 I thought that might be the case so looks like learning =0A=
some javascript is in order!=A0 I want to get that data direct from =0Asour=
ce.
=0A
=0AYes, it crossed my mind that sticking with PERL might be easier, I've =
=0Alost almost 2 months already (I was ill for 3 weeks with flu) and am =0A=
quite results oriented now!=A0 I can always try to redo bits later as =0Ane=
cessary.=A0 So I may use perl to stick the data into sql/access and then=0A=
 use C++ to get it back out/manipulate it.=A0 By the time I'm at that =0Ast=
age I should have more of an overall structure to what I'm trying to =0Ado!
=0A
=0AIf anyone else has any ideas/advice, much appreciated!
=0A
=0ABest,
=0A
=0ACarl

--- On Sun, 16/1/11, Mike Williams <[email protected]> wrote:

From: Mike Williams <[email protected]>
Subject: Re: Stuck automating login to reuters.com and getting a page
To: "Carl Wells" <[email protected]>
Cc: [email protected]
Date: Sunday, 16 January, 2011, 13:31

On Sun, Jan 16, 2011 at 7:48 AM, Carl Wells <[email protected]> wrote:
=0A=0AHi,
=0A
=0AI hope you don't mind my newbie question. =A0I'm new to web-programming =
(and indeed am somewhat rusty with programming in general). =A0I'm out of w=
ork and trying to teach myself C++, PERL, SQL and other skills and in order=
 to do this I've set myself a project. =A0As part of this project I need to=
 access data from this URL:
=0A=0A=0A
=0Ahttp://www.reuters.com/finance/stocks/incomeStatement/detail?perType=3DA=
NN&symbol=3DBATS.L
=0A
=0Athe problem I'm having is that this redirects to the reuters.com login p=
age. =A0I've tried to use both existing cookie files from internet explorer=
 (I had to rename these because the name of the cookie involved my user nam=
e which incorporates a space and an @ e.g. fred [email protected] and =
Perl didn't seem to like that/my syntax was wrong) and setting up perl to r=
eceive a new cookie from the site. =A0Neither has worked for me. =A0I've sp=
ent the past 3 days trying to glue bits of code together from various googl=
es and the cpan module descriptions for LWP and Mechanize. =A0An example of=
 code thats not working for me is as below:
=0A=0A=0A

Carl,
=A0
Hi there.=A0 One big problem here is that the login page contains javascrip=
t.=A0 If the javascript code is not run on the client side then whatever yo=
u post will not work.
=0A=0ASorry, but I do not know of a way around this, I've tried similar thi=
ngs in the past and had no luck.=A0 For forms that do not include javascrip=
t WWW::Mechanize works nicely.

If you have any other specific perl issues post them here.=A0 Or maybe some=
one knows a way around this javascript issue and we'll both learn something=
.=20
=0A=0A
You're tackling a lot of different things at one time: c++, perl, sql, CGI =
and xs=A0 - you may want to consider narrowing your focus a bit.

As far as the c++ issues go, I would suggest that you first have the perl c=
ode write the data to disk, then have the c++ code read it off the disk, or=
 just do whatever you intend to do with the data all in perl.=A0 Calling pe=
rl from c++ is a large can of worms.=A0 Unless you have a compelling reason=
 for doing this, I would advise against it.=A0 It might be easier to put yo=
ur c++ code in a library and then create a wrapper around that with xs.=A0 =
One approach that generally works for me is to identify stand alone tasks, =
get them working by themselves, then work on making them play together.
=0A=0A
Mike

=0A=0A=0A=0A      
--0-1371451045-1295195888=:7251--