Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-04-25 05:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found