RE: Accessing Web from a program

  • From: "Ken Perry" <whistler@xxxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sat, 1 Mar 2008 21:14:15 -0800


Nod you have brought up many of the things I have thought of.  If I had the
$500 to spend I would purchase IMacros because it does all the nasty waiting
and parsing that I will have to do.  I will keep your response though
because Perl might end up being the best of the worst worlds without paying
for something like IMacros.

Ken 

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Octavian Rasnita
Sent: Saturday, March 01, 2008 7:32 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: Accessing Web from a program

Ok, I understand. I don't have a sample code that can help you, but
depending on what you want to do, it might be a little harder to do.

To create the GUI may be simple, and to log on the server could be also
simple, but after logging in, it might be pretty hard to parse the web page
in order to get the relevant content (a table for example) and store its
content into a list in the GUI.

If you would make the program in perl, you could use the accessible
libraries for creating GUIS (Win32::GUI or WxPerl), and me and Jamal had
presented some FruitBasket samples with these libraries. If you want to log
in a site, you could use a code like:

use LWP::Simple;
my $page_content =
get(http://www.site.com/login.php?username=user&password=pass);

This will let you get the page that appears after you log in, and you can
parse its content. There are some CPAN modules that can help you to do that,
but I always prefered using simple regular expressions.

Then you can print the result you got in the GUI.

These are only the basics, because actually it is some more difficult.

You shouldn't use LWP::Simple to get only a single page after you log in,
but you do need LWP::UserAgent, because it allows you to also get and save
cookies, then send them to the server on the subsequent accesses, because
otherwise it won't consider you an authorized user.

Doing these things could involve some work, but it is not such a difficult
thing, but if you also want your app to work nice and to be responsive, you
might need to use some worker threads that fetch the pages, because
otherwise the app might seem to be frozen until the web page has been
fetched.
Using threads in perl is not very easy, and that's why perl is not very
suitable for creating apps with GUIS. A perl thread is almost like a
process, and even if there are some modules that allow sharing simple
variables between threads, they don't allow you to share handles and
objects. Because of this, you can't share a database handle for example.

Of course, for what you want, you might do it without many issues, but as I
never done exactly what you want, I don't know what problems could appear.

Octavian

----- Original Message -----
From: "Ken Perry" <whistler@xxxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Sunday, March 02, 2008 12:28 AM
Subject: RE: Accessing Web from a program


>
>
> I am making a program that will log a person into their user account at a
> less than accessible web page then I will present some tasks that they can
> do their and give them an accessible gui rather than fight with an ugly 
> web
> interface..
>
> Ken
>
> -----Original Message-----
> From: programmingblind-bounce@xxxxxxxxxxxxx
> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Octavian 
> Rasnita
> Sent: Saturday, March 01, 2008 11:53 AM
> To: programmingblind@xxxxxxxxxxxxx
> Subject: Re: Accessing Web from a program
>
> Hi,
>
> I don't understand what you exactly want. Can you be a little more 
> specific?
>
> Do you want a program with a native Windows GUI, or with a web based GUI?
>
> Do you want a simple CGI program made in perl that gets some parameters 
> and
> send them to the server, or you want a Windows GUI program that fetch a 
> web
> page and do something with its content, or send some content to a certain
> program that runs on a web page?
>
>
>
>
> Octavian
>
> ----- Original Message -----
> From: "Ken Perry" <whistler@xxxxxxxxxxxxx>
> To: <programmingblind@xxxxxxxxxxxxx>
> Sent: Saturday, March 01, 2008 7:09 PM
> Subject: Accessing Web from a program
>
>
>>
>>
>> I am looking for sample code in any language that creates a dialog out of
>> a
>> form on a web site and allows someone to submit that form after the 
>> person
>> enters the information.  Note that I need this to be GUI based and the
>> GUI's
>> must be accessible.  If there is a library for this just point that out
>> and
>> I will be off and running.  All the examples I have found on the web just
>> suck so I am hoping someone here has done it.
>>
>> Ken
>>
>>
>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
> 

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: