I'm retrieving HTTP headers from files in order to determine if the link is good, bad, or unauthorized. However, when I test against some CGI scripts on the site, The header returns "HTTP/1.1 403 (Forbidden) invalid method." I'm trying to determine if the CGI ... 1) is alive and there, or 2) does it find what it was sent to search for.
Am I simply trying to access the CGI inproperly or is there something else that's wrong? Thanks for any help you can provide.
Note: I do not have access to look at/modify this CGI.
Code:
use LWP::UserAgent;
use LWP::Simple;
use HTTP::Request::Common;
$link =
"http://www.mycorpsite.com/cgi-bin/gx.cgi/AppLogic+emd.query?full=yes&
+uid=lamer";
$ua = LWP::UserAgent->new;
$req = HTTP::Request->new(GET => $link);
$results =
$ua->request(HTTP::Request::Common::HEAD($link))->as_string;
print "$results";
Output:
HTTP/1.1 403 (Forbidden) invalid method
Connection: close
Date: Fri, 29 Jun 2001 15:32:49 GMT
Server: Netscape-Enterprise/3.6 SP3
Content-Length: 152
Content-Type: text/html
Client-Date: Fri, 29 Jun 2001 15:32:50 GMT
Client-Peer: 151.119.136.124:80
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.