I have created a code from which I am getting and 302 Object Moved error: Here is my code:
use HTML::Entities; # encode and decode things like <, >, and & use HTML::Form; # for form processing use HTTP::Cookies; # keep track of cookie use HTTP::Request::Common; use LWP::UserAgent; # pretend we are a browser use Data::Dumper; use Exporter; use LWP::Debug qw(+); use strict; my $url = 'https://interddt.com/cqweb/logon/default_content.asp'; my $browser = LWP::UserAgent->new; my $response = $browser->request(POST "$url", [ DatabaseName => 'TECH' +, User => '<user id>', Password => '<password>' ]); die "Error at $url\n ", $response->status_line, "\n Aborting" unless $response->is_success; print "Whee, it worked! I got that ", $response->content_type, " document!\n";
And here is the output of the LWP debug trace from this code
#> perl ./test.pl LWP::UserAgent::new: () LWP::UserAgent::request: () LWP::UserAgent::simple_request: POST https://dtinterddt.digitalthink.c +om/cqweb/logon/default_content.asp LWP::UserAgent::_need_proxy: Not proxied LWP::Protocol::http::request: () LWP::Protocol::http::request: POST /cqweb/logon/default_content.asp HT +TP/1.0 Host: dtinterddt.digitalthink.com User-Agent: libwww-perl/5.53 Content-Length: 48 Content-Type: application/x-www-form-urlencoded LWP::Protocol::http::request: POST /cqweb/logon/default_content.asp HT +TP/1.0 Host: dtinterddt.digitalthink.com User-Agent: libwww-perl/5.53 Content-Length: 48 Content-Type: application/x-www-form-urlencoded LWP::Protocol::http::request: reading response LWP::Protocol::http::request: HTTP/1.1 302 Object moved Server: Microsoft-IIS/5.0 Date: Mon, 06 Dec 2004 10:58:27 GMT Location: /cqweb/default_content.asp Connection: Keep-Alive Content-Length: 121 Content-Type: text/html Set-Cookie: CQWebUsrSettings=LOGON%5FUSER=dkhanna&LOGON%5FDBSET=2002%2 +52e05%252e00&LOGON%5FDB=TECH; expires=Mon, 27-Dec-2004 08:00:00 GMT; +path=/ LWP::Protocol::http::request: HTTP/1.1 302 Object moved LWP::Protocol::http::request: need more header data LWP::Protocol::collect: read 21 bytes LWP::Protocol::collect: read 100 bytes LWP::UserAgent::request: Simple response: Found Error at https://dtinterddt.digitalthink.com/cqweb/logon/default_conte +nt.asp 302 Object moved Aborting at ./test.pl line 16

2004-12-08 Janitored by Arunbear - added code tags, as per Monastery guidelines


In reply to 302 object moved error by dkhanna01

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.