jeanluca has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks

I like to visit a website using a perl script. So the only thing this script shoud do is something like:
@var = http://www.dsfhf.ff/somescript.cgi?select=2

Just an example. I get the feeling this doesn't work, but hopefully it makes clear what I need.

What is the best way to do this ?

Thanks in advance
Luca

Replies are listed 'Best First'.
Re: Visit web-pages using perl
by ikegami (Patriarch) on Sep 22, 2005 at 15:29 UTC

    LWP::Simple (and other LWP modules) can help you download web pages. There's also WWW::Mechanize if you have to worry about sessions.

    I'm not sure what you're assigning to an array, though. That implies you wish to fetch multiple "somethings"? I don't know what that "something" would be.

      The array was an example. I just like to access a mysql database on a remote computer using apache. So I send a request to that cgi script. That cgi script accesses a database and returns the output back to this script.

      Luca

        There are two approaches to this, depending on how important this is and how flexible/extensible/stable you want or need it to be.

        The simple way would be to cause the CGI to return the data in some easily-parsible form, like a Storable block, an XML document, or something similar, then parse it on the client side appropriately.

        The ideal way would be to implement a SOAP (or other web-services API) service on the server, and write a client for it.

        <-radiant.matrix->
        Larry Wall is Yoda: there is no try{} (ok, except in Perl6; way to ruin a joke, Larry! ;P)
        The Code that can be seen is not the true Code
        "In any sufficiently large group of people, most are idiots" - Kaa's Law
Re: Visit web-pages using perl
by cog (Parson) on Sep 22, 2005 at 15:28 UTC