Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: LWP Post Question

by marcussen (Pilgrim)
on Jul 17, 2008 at 01:36 UTC ( #698209=note: print w/replies, xml ) Need Help??

in reply to LWP Post Question

Although my headers look slightly different to yours (no bi, bx, ds, etc) I found that a GET request does the trick. Here is my tamper data transcript:
1:24:34.883[278ms][total 278ms] Status: 302[Moved Temporarily] POST Load Flags[LOAD_DOC +UMENT_URI LOAD_INITIAL_DOCUMENT_URI ] Content Size[20] Mime Type[te +xt/plain] Request Headers: Host[] User-Agent[Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9) Gec +ko/2008061017 Firefox/3.0] Accept[text/html,application/xhtml+xml,application/xml;q=0.9,*/* +;q=0.8] 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] Connection[keep-alive] Referer[] Cookie[visited=false; H9U4=2-2-4AF2B353F25D1563A7EFF64C9C8C966F1 +CC47B51D9B4FC20BF7EC22C1159C36E-62EFF0DD7924B97457302616162F154647325 +FF38A3CBE949CD1AE8180BAE484; H9U4SE=1; abe_vc=1] Post Data: sts[t] tn[Codex+Seraphinianus] x[53] y[15] Response Headers: Location[ +Codex+Seraphinianus&x=53&y=15] Content-Type[text/plain; charset=ISO-8859-1] Content-Encoding[gzip] Content-Length[20] Expires[Thu, 17 Jul 2008 01:24:29 GMT] Cache-Control[max-age=0, no-cache, no-store] Pragma[no-cache] Date[Thu, 17 Jul 2008 01:24:29 GMT] Vary[Accept-Encoding] Connection[keep-alive]

Notice the 302 response?

So I modified the url to look for some made up book title; And sent a GET request... voila!

Confucius says kill mosquito unless cannon

Replies are listed 'Best First'.
Re^2: LWP Post Question
by drblove27 (Sexton) on Jul 17, 2008 at 01:46 UTC
    Do you suppose that there is a way to do this with post? (Not to be picky, but trying to learn the madness of both methods)... But this does actually beg the question, if the form on the web page is a post, why is get working here?
      The form is a POST, but the site sends back a 302, and then the browser sends a GET. Notice the contents of the browser URL box after the has all the parameters in the query string of the URL. Why it does it that way, I dunno. But the answer is to just send a GET from LWP in the first place.
        So the 302 response means that it sends a Post request, but then shoots back a "get" type form. Huh... In theory though this could be done with a POST where LWP follows the "get" response if I could figure out what the right thing to pass it would be. Ok...

        Can anyone point to a POST tutorial that actual works? :) Most of the ones that I find from the Google no longer work... or my cut and paste skills are sub par (totally willing to believe as well)...


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://698209]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2018-06-21 13:12 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (118 votes). Check out past polls.