Gossamer Forum
Home : General : Perl Programming :

lwp::simple question... ?!?!?!?

Quote Reply
lwp::simple question... ?!?!?!?
ok im using LWP:simple and was wondering when using the get command. Ex.
#!/usr/bin/perl
use LWP::Simple;
$url = "http://www.yahoo.com/"
$site = get $url;
thingy can you choose the meathod.. like I need to get something using
application/x-www-form-urlencoded

is it possible???
Quote Reply
Re: lwp::simple question... ?!?!?!? In reply to
Of course you can get an image. But you are still using GET method.
To fill up a form, you need to use PUT method and this requires LWP::UserAgent.
Quote Reply
Re: lwp::simple question... ?!?!?!? In reply to
can someone please give an example of using LWP::Useragent , application/x-www-form-urlencoded and put meathod sending variables to a cgi script..? please.
Quote Reply
Re: lwp::simple question... ?!?!?!? In reply to
No.
You have to use LWP::UserAgent.
Quote Reply
Re: lwp::simple question... ?!?!?!? In reply to
In Perl everything is possible Smile
Here's a little exaple on how to get an image using LWP
Code:
#!/usr/local/bin/perl
# fetch an image 1.0
# Copyright, 2000, Pavel Golovko
# http://www.cellwarp.com

use strict;
use CGI;
use LWP::Simple;
my $in = new CGI;

# image that you want to fetch from another server:
my $gif = "http://www.very-cool-stuff.com/ubb/icons/icon6.gif";

my $gifresults = get ($gif);

# change the following code line to
# print CGI->header('image/jpeg');
# if your image has .JPG enging.
print CGI->header('image/gif');

print "$gifresults";
If you change some code here, then you can get that URL using your application/x-www-form-urlencoded method Smile
Quote Reply
Re: lwp::simple question... ?!?!?!? In reply to
Check its documentation at:
http://www.cpan.org
Quote Reply
Re: lwp::simple question... ?!?!?!? In reply to
dont explain how to use it.. can someone give me a example please.
Quote Reply
Re: lwp::simple question... ?!?!?!? In reply to
I could not find it.. can you please give me a exact url.. please. thanks in advance
Quote Reply
Re: lwp::simple question... ?!?!?!? In reply to
there is a LWP cookbook at cpan.org where you can find an example.
Quote Reply
Re: lwp::simple question... ?!?!?!? In reply to
found it thanks
Quote Reply
Re: lwp::simple question... ?!?!?!? In reply to
Hi!

I know this is possible, but not sure how to go about doing it? I've tried to get my host to install LWP...without success. Anyway, how would I go about installing LWP on my own virtual account? Thanks for your help.
Quote Reply
Re: lwp::simple question... ?!?!?!? In reply to
Getting to install in your own directory can supposedly be done, albeit very difficult.

I havent heard of very many success stories.

For reference:

http://www.gossamer-threads.com/...um2/HTML/002262.html

--mark
Quote Reply
Re: lwp::simple question... ?!?!?!? In reply to
Thanks for the reference Mark. :-) I must have overlooked that post and it seems simple enough for them to install. They tried installing it once before, but said that it required to many other things they didn't have installed?? Anyway, I appreciate the help and I'll send the instructions to them.

Thank You
Quote Reply
Re: lwp::simple question... ?!?!?!? In reply to
Cool glad it could help.

if they can't install it from that then switch hosts immediatly cuz their clueless.

The very first session I had on a Unix box of my own, I learned how to install perl modules, on the 1st try. There's nothing to it.
Quote Reply
Re: lwp::simple question... ?!?!?!? In reply to
Hey Mark,

Well I figured I'd share the outcome of this with you...after they installed as suggested, this is what they came up with:

Warning: prerequisite Digest::MD5 0 not found at (eval 1) line 220.
Warning: prerequisite HTML::HeadParser 0 not found at (eval 1) line 220.

Warning: prerequisite MIME::Base64 2.1 not found at (eval 1) line 220.
Warning: prerequisite Net::FTP 2.4 not found at (eval 1) line 220.
Warning: prerequisite URI 1.03 not found at (eval 1) line 220.

There are prerequisites needed for this.

It can still be setup without these, but you may find that some things may still not work properly.

I have no idea what that means!!! Oh well, other than this, I'm pretty happy with their service. I thank you again for you help.

see ya
Quote Reply
Re: lwp::simple question... ?!?!?!? In reply to
i think they just work with different modules, but arent needed. in fact, i think i got that on my box too and ignored it. and im lwp'ing like a champ Smile

--mark
Quote Reply
Re: lwp::simple question... ?!?!?!? In reply to
Right on.....I'll let them know! I wish I knew more about installing things on servers...but haven't the slightest clue when it comes to that. Thanks alot for your reponses Mark, you've been very helpful. Hopefully all goes well. :-)