[ic] Grabbing a web page content using LWP::Simple
Ed LaFrance
edl@newmediaems.com
Thu, 22 Mar 2001 09:19:32 -0800
At 11:06 PM 03/21/2001 -0500, you wrote:
>I need to grab the contents of a web page. I have tried using the below
>code.
>
>[perl Global=1 subs=1]
>use LWP::Simple
>my $return=LWP::Simple::get('http::/www.somesite.com/index.html')
>return $return
>[/perl]
>
>No matter what library I use and the arguments to the perl call. I can not
>get it to return the page. It will send the request but will hang up trying
>to read from the socket.
>
>I have tried setting it up as a Global Sub, as a usertag and plain perl
>using Use Socket. The code will work fine outside of minivend but will
>always hang when it comes to reading from the socket. It will write to the
>socket but can not read from it.
>
>How can one read in the contents of a web page?
I assume you have verified that LWP::Simple is installed. Did you try the
GET utility? it comes with the example scripts in the LWP dist, in a /bin
subdirectory, or it may already be in your /usr/bin or /usr/local/bin. Try
at the command line:
GET http://www.someworkingsite.comn
...if it works you will see the html echoed to the screen. Also, there is
a [get_url] usertag for Interchange, have you tried that?
- Ed L.
===============================================================
**** Virtual Hosting w/private IC Installation, $65/month! ****
---------------------------------------------------------------
New Media E.M.S. Software Solutions for Business
463 Main St., Suite D eCommerce | Consulting | Hosting
Placerville, CA 95667 edl@newmediaems.com
(530) 622-9421 http://www.newmediaems.com
(866) 519-4680 Toll-Free (530) 622-9426 Fax
===============================================================