need help in updating a website using perl script.
- From: "rock" <abbas.patel@xxxxxxxxx>
- Date: 21 Nov 2005 04:10:11 -0800
Hi All,
I am not sure if this is the right place to post this problem or
not...But believe me this is my first time posting to this group.
I am trying to write a perl script to update a protected bugzilla
database and have gone through many such topics in google groups, and
got a lot of helpful hints. I am using the POST method from the
"http::request" for the same following is the code snippet that I have
developped for the same:
>Code Snippet<
my $url="http://path to bugzilla/process_bug.cgi?id=bugid";
my $ua = LWP::UserAgent->new;
my $req; #Request
my $res; #Response
my $username = 'username';
#(Username for the protected website as the bugzilla directory on the
server is also protected)
my $password = 'password';
$req = new HTTP::Request 'POST' , $url;
$req->content_type('application/x-www-form-urlencoded');
$req->authorization_basic($username, $password);
$res = $ua->request($req);
if ($res->is_success) {
print $res->content;
}
else {
print "fail\n";
}
>Snippet<
My questions are as follows:
1) Bugzilla program is also password protected can I authenticate the
bugzilla database using the $req->content(key = value) method?
2) I get the following error when I run this perl script:
>Snippet<
fail
_protocolHTTP/1.0_requestHTTP::Request=HASH(0x1835384)_headersHTTP::Headers=HASH(0x21fc6b4)_msgLength
Required_rc411_content<!DOCT
YPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><META HTTP-EQUIV="Content-Type" CONTENT="text/html;
charset=iso-8859-1">
<TITLE>ERROR: The requested URL could not be retrieved</TITLE>
<STYLE
type="text/css"><!--BODY{background-color:#ffffff;font-family:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>
</HEAD><BODY>
<H1>ERROR</H1>
<H2>The requested URL could not be retrieved</H2>
<HR noshade size="1px">
<P>
While trying to process the request:
<PRE>
POST /path to bugzilla HTTP/1.1
TE: deflate,gzip;q=0.3
Connection: TE, close
Authorization: Basic OTE2ODk1Om1hazExMzQubWo=
Host: Host on which bugzilla reside
User-Agent: libwww-perl/5.64
Content-Type: application/x-www-form-urlencoded
</PRE>
<P>
The following error was encountered:
<UL>
<LI>
<STRONG>
Invalid Request
</STRONG>
</UL>
<P>
Some aspect of the HTTP Request is invalid. Possible problems:
<UL>
<LI>Missing or unknown request method
<LI>Missing URL
<LI>Missing HTTP Identifier (HTTP/1.0)
<LI>Request is too large
<LI>Content-Length missing for POST or PUT requests
<LI>Illegal character in hostname; underscores are not allowed
</UL>
<P>Your cache administrator is <A HREF="mailto:root">root</A>.
>SNIPPETt<
But intrestingly when I change the POST method to a GET method I can
sucessfully run through the page.
Am I missing on some basic thing for the POST method to be executed
sucessfully?
PS: My bugzilla server is behinde a squid redirector.
Any help would be appriciated in this regards.
Thanking in anticipation,
Abbas.
.
- Prev by Date: Re: XML Parsing too slow with XML::Simple
- Next by Date: Re: Perl Getops
- Previous by thread: FAQ 6.11 Can I use Perl regular expressions to match balanced text?
- Next by thread: two arrays
- Index(es):
Relevant Pages
|