CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
Perl Script - Pull web page?

 



mike robb
Deleted

Aug 20, 2000, 1:40 PM

Post #1 of 7 (1305 views)
Perl Script - Pull web page? Can't Post

I am trying to pull a web page from a file on another server into an array.

I need to do some pre-processing on the page before sending it to the client(user).

Any ideas?

Thanks Smile

--Mike


perlkid
stranger

Aug 20, 2000, 8:06 PM

Post #2 of 7 (1305 views)
Re: Perl Script - Pull web page? [In reply to] Can't Post

 
Hey Mike, How's it goin?

I have an idea.

Try using LWP::Simple;

like so,

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


use LWP::Simple;
$content = get("http://www.site.com");
</pre><HR></BLOCKQUOTE>

Now you can do whatever you want to the html of the web site wich is stored in $content.

If you want to you can even add the line

push(@array, $content);

If you want to treat the html as an array.

Hope That helps,

Perlkid


mike robb
Deleted

Aug 21, 2000, 7:54 AM

Post #3 of 7 (1305 views)
Re: Perl Script - Pull web page? [In reply to] Can't Post

Thanks!


ka0osk
Deleted

Aug 30, 2000, 6:21 AM

Post #4 of 7 (1305 views)
Re: Perl Script - Pull web page? [In reply to] Can't Post

Going further, how could you then pull .gifs and save them to the local server? I want to pull in the pics for my local work screens (radar images etc..) in a home automation Perl thingy I'm doing.


------------------
John (ka0osk@netscape.net)


dws
Deleted

Sep 1, 2000, 4:41 PM

Post #5 of 7 (1305 views)
Re: Perl Script - Pull web page? [In reply to] Can't Post

See perlkid's reply above. LWP::get() works for GIFs too.


Cure
User

Sep 2, 2000, 10:01 PM

Post #6 of 7 (1305 views)
Re: Perl Script - Pull web page? [In reply to] Can't Post

LWP::get(); <----- doesnt make sense Smile

LWP::Simple module has a get() function which will fetch the document identified by the given URL and return it. It returns undef if it fails. The $url argument can
be either a simple string or a reference to a URI object.


The LWP::Simple module also has a getprint() which will get and print a document identified by a URL. The document is printed
to STDOUT as data is received from the network. If the request fails, then the status code and message are printed on STDERR. The return value is the HTTP response code.

If you need more control or access to the header fields in the requests sent and responses received you should use the full object oriented interface provided by the LWP::UserAgent module.


Cure

[This message has been edited by Cure (edited 09-03-2000).]


ka0osk
Deleted

Sep 5, 2000, 4:52 AM

Post #7 of 7 (1305 views)
Re: Perl Script - Pull web page? [In reply to] Can't Post

The gif solution involved mirror() in the LWP, and works great. - Thanks for all your help!



------------------
John (ka0osk@netscape.net)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives