Dear Monks,

I am having one hell of a time trying to get my LWP script to work with this aggravating web server using tons of javascript, jsp, and one of those awful oracle web/database solution Larry Ellison fools people into buying.

My script does this ...

. . . $UA->cookie_jar->add_cookie_header(); $resp = $UA->post ( $actionUrl, @ns_headers, 'Content_type' => 'application/x-www-form-urlencoded', 'Content' => [ <... a bunch of stuff ...> ] ); . . .

What that is suppose to do is create add some data to a database, but when I check the database there is nothing to be found.

When I submit the form via a browser everthing works fine, so I decided to do a tcpdump when I run my script and when I submit the form via the browser and look for differnces. And there are! When I run my script I get this tcpdump output:

POST /ditor/ditctl.do?method=save HTTP/1.1 Connection: keep-alive Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9 +,text/plain;q=0.8;,image/png,*/*;q=0.5 Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.7 Accept-Encoding: gzip,deflate Accept-Language: en-us,en;q=0.5 Host: somejunk.js.jps.com:8888 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20 +050512 Red Hat/1.7.8-1.1.3.1 Content-Length: 336 Content-Type: application/x-www-form-urlencoded Cookie: JSESSIONID=1545454aae552555a48773717374620 Cookie2: $Version="1" Keep-Alive: 300 !pu` !pu` content=things&blah=balhahah&morejunk=&nonsense=xyz !pu` HTTP/1.1 100 Continue Server: Oracle9iAS (9.0.3.0.0) Containers for J2EE Date: Tue, 12 Jul 2005 18:00:00 GMT !pu` !pu` HTTP/1/1 200 OK Date: Tue, 12 Jul 2005 18:00:00 GMT Server: Oracle9iAS (9.0.3.0.0) Containers for J2EE Connection: Close Content-Type: text/html Transfer-Encoding:chunked <EOT>

But when I submit the form via the browser I get this output from tcpdump ...

POST /ditor/ditctl.do?method=save HTTP/1.1 Host: somejunk.js.jps.com:8888 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20 +050512 Red Hat/1.7.8-1.1.3.1 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9 +,text/plain;q=0.8;,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Referer: http://somejunk.js.jps.com:8888/ditor/ditctl.do?stuff=stuff Cookie: JSESSIONID=9989887adf879da987982jkd11 !pu` !pu` Content-Type: application/x-www-form-urlencoded Content-Length: 384 content=things&blah=balhahah&morejunk=&nonsense=xyz !pu` HTTP/1.1 100 Continue Server: Oracle9iAS (9.0.3.0.0) Containers for J2EE Date: Tue, 12 Jul 2005 17:29:04 GMT !pu` !pu` HTTP/1/1 200 OK Date: Tue, 12 Jul 2005 17:29:04 GMT Server: Oracle9iAS (9.0.3.0.0) Containers for J2EE Content-Location: http://somejunk.js.jps.com:8888/ditor/Some.jps Connection: Keep-Alive Keep-Alive: tomeout=15, max=100 Content-Type: text/html Transfer-Encoding:chunked ... a bunch html ...

What is going on after the form is submitted? What's this Content-Location header? How can I make my script do what the browser does??? Thanks!

READMORE tags added by Arunbear


In reply to Submit from browser works but LWP does not by Plankton

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.