I am using the following script, but it failed with "500 read failed" with the long URL get request:
#!/usr/bin/perl -w
use strict;
use HTTP::Cookies;
use LWP::UserAgent;
use URI::URL;
my $ua = LWP::UserAgent->new;
$ua->requests_redirectable ( ['GET', 'HEAD', 'POST'] );
my $cookie_jar = HTTP::Cookies->new;
$ua->cookie_jar ($cookie_jar);
$ua->agent ("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"); # p
+retends to be IE6
my $url = url 'https://advertise.latimes.com/';
my $res = $ua->get($url);
print $res->is_success,"\n";
#$url = url 'https://advertise.latimes.com/portal/page/portal/LA%20Tim
+es';
$url = url 'https://advertise.latimes.com/portal/event/portal/LA%20Tim
+es?_pageid=273,1&_dad=portal&_schema=PORTAL&_portlet_ref=273_150732_2
+73_1_1&_eventName_register=';
$res = $ua->get($url);
print $res->is_success,"\n";
print $res->content,"\n";
Please note that it can successfully access the following URLs:
1. https://advertise.latimes.com;
2. https://advertise.latimes.com/portal/page/portal/LA%20Times;
But it can't handle this URL (which is doing urlrewrite in Portal):
https://advertise.latimes.com/portal/event/portal/LA%20Times?_pageid=273,1&_dad=portal&_schema=PORTAL&_portlet_ref=273_150732_273_1_1&_eventName_register=
I can access this URL using browser without any problem, so what the problem with LWP?
Can someone try it on your side and let me know what's your results? I am wondering if I should use Perl 5.6 instead of 5.8?
Edit: g0n - replaced pre tags with code tags
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.