in reply to http get with perl, help needed

Yes, I would.

use strict; use warnings; use LWP::UserAgent qw( ); use URI::Escape qw( uri_escape ); my $ua = LWP::UserAgent->new(); my $response = $ua->get(sprintf( 'http://test.test.com/ws/ws.asmx/DecryptText?text=%s&key=%s', uri_escape($text), uri_escape($key), )); if (!$response->is_success()) { die($response->status_line(), "\n"); } binmode STDOUT; print $response->content();

Update: s/\$ua->request/\$ua->get/ as per reply.

Replies are listed 'Best First'.
Re^2: http get with perl, help needed
by perlnewb123 (Sexton) on Oct 16, 2008 at 21:06 UTC
    Thank you!. What would I use for the request though? Assuming I do this:
    use strict; use warnings; use LWP::UserAgent qw( ); use URI::Escape qw( uri_escape ); my $ua = LWP::UserAgent->new(); my $response = $ua->request(sprintf( 'http://test.test.com/ws/ws.asmx/DecryptText?text=%s&key=%s', uri_escape('SomeText'), uri_escape('SomeDecryptionKey'), )); if (!$response->is_success()) { die($response->status_line(), "\n"); } binmode STDOUT; print $response->content();
    I get an error back:
    You need a request object, not 'http://test.test.com/ws/ws.asmx/Decryp +tText?text=SomeText&key=SomeDecryptionKey' at test.pl line 10
      Oops, that should be $ua->get(...) rather $ua->request(...)
        THANKS!!!! Now Im getting a 401 Unauthorized. I shouldnt have to pass a uid/password to this site, but if I need to how would I pass the creds in this script?