Networking Forums

Networking Forums > Computer Networking > Linux Networking > how to interact with web page from script

Reply
Thread Tools Display Modes

how to interact with web page from script

 
 
Eric
Guest
Posts: n/a

 
      07-19-2005, 05:07 AM
I'm using Linux - Manriva LE2005, python 2.3 (or i can also use python 2.4
on my other system just as well).
Anyways...
I want to get a web page containing my stock grants.
The initial page is an https and there is a form on it to
fill in your username and password and then click "login"
I played with python's urlopen and basically it complains "your browser
doesnt support frames" meaning the urlopen call makes it unhappy somehow.
Is it reasonable to think i can build a script to login to this secure
website, move to a different page (on that site) and download it to disk?
Or am i just looking at a long complicated task.
I'd really like to get the page because then i can analyze it from a cron
job and email myself my current options value each week or each month.

Any ideas as to how to proceed with this quest? I dont need to use python
either it was just a starting place.
Thanks
Eric
 
Reply With Quote
 
 
 
 
ynotssor
Guest
Posts: n/a

 
      07-19-2005, 06:06 AM
"Eric" <BorgMotherShip@AliensR_US.org> wrote in message
news:EbadncCu64c3F0HfRVn-(E-Mail Removed)...

> I want to get a web page containing my stock grants.
> The initial page is an https and there is a form on it to
> fill in your username and password and then click "login"
> I played with python's urlopen and basically it complains "your browser
> doesnt support frames" meaning the urlopen call makes it unhappy somehow.


The page you're trying to open employs the use of frames, which your urlopen
doesn't support.

> Is it reasonable to think i can build a script to login to this secure
> website, move to a different page (on that site) and download it to disk?


Yes, except you'll want to go directly to the page that provides the data of
interest, rather than navigating after the authorization. One can determine
this in Firefox by right-clicking the frame of interest, then "Show only
this frame" and taking note of the URL that gets displayed.

> Any ideas as to how to proceed with this quest?


It depends on the format of the page contained in the frame that is
delivering the data.

If one needs to simply download that HTML page, then (e.g.):

#!/bin/bash
tempfile=/tmp/filename
echo 'To: (E-Mail Removed)in
Subject: Daily stock report
Cc: (E-Mail Removed)
Content-Type: text/html; boundary="-- boundary --"

' > $tempfile
/usr/bin/wget -O- --http-user=USER --http-passwd=PASS \
https://the/exact/URL >> $tempfile 2> /dev/null
/usr/sbin/sendmail -t < $tempfile
# end script

If the page is a "form" that requires specific input, then you'll have to
examine the page source to get the field (-F) names, and the name of the
other incidentals, then use cURL http://freshmeat.net/projects/curl/ to
submit the form with the correct field (-F) values, e.g.:

datetoday=`date '+%D'`
/usr/bin/curl -F "Starting Date"=$datetoday \
-F "Ending Date"=$datetoday https://the/exact/URL > $tempfile 2>
/dev/null

You can handle the output depending on whether it's a csv file, HTML, ascii
text etc.




 
Reply With Quote
 
Alan Connor
Guest
Posts: n/a

 
      07-19-2005, 06:20 AM
On alt.os.linux, in <EbadncCu64c3F0HfRVn-(E-Mail Removed)>, "Eric"
wrote:

> I'm using Linux - Manriva LE2005, python 2.3 (or i can also
> use python 2.4 on my other system just as well). Anyways...
> I want to get a web page containing my stock grants. The
> initial page is an https and there is a form on it to fill in
> your username and password and then click "login" I played
> with python's urlopen and basically it complains "your browser
> doesnt support frames" meaning the urlopen call makes it
> unhappy somehow. Is it reasonable to think i can build a
> script to login to this secure website, move to a different
> page (on that site) and download it to disk? Or am i just
> looking at a long complicated task. I'd really like to get the
> page because then i can analyze it from a cron job and email
> myself my current options value each week or each month.
>
> Any ideas as to how to proceed with this quest? I dont need to
> use python either it was just a starting place. Thanks Eric


GNU wget supports HTTPS and some authentication.
Give the manpage a look.

You can use a fake User-Agent string to fool the server into
thinking you are running IE, but I don't know if that covers the
frames thing.

My textmode browser can deal with frames, so I don't think it
is that big of a problem.

Try comp.unix.shell

AC

--
http://home.earthlink.net/~alanconnor/
http://angel.1jh.com./nanae/kooks/alanconnor.html
 
Reply With Quote
 
Eric
Guest
Posts: n/a

 
      07-19-2005, 07:15 AM
Eric wrote:

> I'm using Linux - Manriva LE2005, python 2.3 (or i can also use python 2.4
> on my other system just as well).
> Anyways...
> I want to get a web page containing my stock grants.
> The initial page is an https and there is a form on it to
> fill in your username and password and then click "login"
> I played with python's urlopen and basically it complains "your browser
> doesnt support frames" meaning the urlopen call makes it unhappy somehow.
> Is it reasonable to think i can build a script to login to this secure
> website, move to a different page (on that site) and download it to disk?
> Or am i just looking at a long complicated task.
> I'd really like to get the page because then i can analyze it from a cron
> job and email myself my current options value each week or each month.
>
> Any ideas as to how to proceed with this quest? I dont need to use python
> either it was just a starting place.
> Thanks
> Eric


OK thanks, you both have given me some good info to work with.
Now i will take some time to experiment with it.
Thanks
Eric
 
Reply With Quote
 
Brian Wakem
Guest
Posts: n/a

 
      07-19-2005, 09:34 AM
Eric wrote:

> I'm using Linux - Manriva LE2005, python 2.3 (or i can also use python 2.4
> on my other system just as well).
> Anyways...
> I want to get a web page containing my stock grants.
> The initial page is an https and there is a form on it to
> fill in your username and password and then click "login"
> I played with python's urlopen and basically it complains "your browser
> doesnt support frames" meaning the urlopen call makes it unhappy somehow.
> Is it reasonable to think i can build a script to login to this secure
> website, move to a different page (on that site) and download it to disk?
> Or am i just looking at a long complicated task.
> I'd really like to get the page because then i can analyze it from a cron
> job and email myself my current options value each week or each month.
>
> Any ideas as to how to proceed with this quest? I dont need to use python
> either it was just a starting place.
> Thanks
> Eric



Have a look at Perl's WWW::Mechanize

http://search.cpan.org/dist/WWW-Mech...W/Mechanize.pm



--
Brian Wakem


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Does anyone know how "remote access" and the firewall interact on a Zyxel 660H tinnews@isbd.co.uk Home Networking 0 04-10-2008 08:41 AM
Setting index.jsp page as home page on IIS JOHN MATHEW Windows Networking 2 09-26-2007 07:43 AM
Copy files using filenames from text files with shell script or bash script altariamx2003@gmail.com Linux Networking 4 11-23-2006 08:27 AM
page Tiziano Wireless Internet 0 09-28-2006 04:38 PM
HOW TO INTERACT WITH FSL EQUATION ConceptZone Wireless Internet 2 08-29-2005 04:49 PM



1 2 3 4 5 6 7 8 9 10 11