in reply to Re: Re: submit Form with Lynx but not Perl?
in thread submit Form with Lynx but not Perl?

No, it's not a cookie problem - I can't see any cookie headers in your trace output (and as you say, you have cookies disabled in Lynx anyway).

Since you're being redirected back to the original page, it looks like there is something wrong with your initial request. My approach would be to use a tool like tcpdump on Linux or Analyzer on Windows to trace the network and compare the Lynx request to the LWP request.

  • Comment on Re: Re: Re: submit Form with Lynx but not Perl?

Replies are listed 'Best First'.
Re: Re: Re: Re: submit Form with Lynx but not Perl?
by Anonymous Monk on Aug 07, 2002 at 11:03 UTC
    Hi,

    Analysing the traffic difference between Perl and Lynx gives me this:

    Lynx sends in one frame POST & URL & field values.
    while Perl sends only POST & URL without field values,
    then Perl waits(?) for an 'ACK'
    and then it sends the field values in another frame and is redirected to the initial page.

    Is there anything to change this behviour?
    This is my code to to get the next form:

    BEGIN { *LWP::UserAgent::redirect_ok = sub {1} } $ub = LWP::UserAgent->new; $ub->agent($MOZILLA); $res = $ub->request($form[1]->click('image',0,0)); # or this: $res = $ub->request(POST $URL, @TEL);
    Again thank you very much for the support,
    it helped me a lot,
    Carl

    LYNX-TRAFFIC:

    Frame 7 (668 on wire, 668 captured) .. Hypertext Transfer Protocol POST /sms/austria.php3 HTTP/1.0\r\n Host: subscriber.chello.at\r\n Accept: text/html, text/plain, application/x-perl, image/jpeg, ima +ge/*, application/x-gunzip, application/x-gzip, application/x-bunzip2 +, application/x-tar-gz, video/*, text/sgml, application/postscript, * +/*;q=0.01\r\n Accept-Encoding: gzip, compress\r\n Accept-Language: en\r\n Pragma: no-cache\r\n Cache-Control: no-cache\r\n User-Agent: Lynx/2.8.4rel.1 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0. +9.6c\r\n Referer: http://subscriber.chello.at/sms/index.php3\r\n Content-type: application/x-www-form-urlencoded\r\n Content-length: 33\r\n \r\n Data (33 bytes) 0000 61 75 73 74 72 69 61 3d 34 33 36 39 39 26 69 6d austria=43699& +im 0010 61 67 65 2e 78 3d 30 26 69 6d 61 67 65 2e 79 3d age.x=0&image. +y= 0020 30 0
    PERL-TRAFFIC:
    Frame 7 (246 on wire, 246 captured) ... Hypertext Transfer Protocol POST /sms/austria.php3 HTTP/1.1\r\n Connection: close\r\n Host: subscriber.chello.at\r\n User-Agent: Perl/sms.pl\r\n Content-Length: 33\r\n Content-Type: application/x-www-form-urlencoded\r\n \r\n Frame 8 (66 on wire, 66 captured) .. Flags: 0x0010 (ACK) 0... .... = Congestion Window Reduced (CWR): Not set .0.. .... = ECN-Echo: Not set ..0. .... = Urgent: Not set ...1 .... = Acknowledgment: Set .... 0... = Push: Not set .... .0.. = Reset: Not set .... ..0. = Syn: Not set .... ...0 = Fin: Not set .. Frame 9 (99 on wire, 99 captured) .. Hypertext Transfer Protocol Data (33 bytes) 0000 61 75 73 74 72 69 61 3d 34 33 36 39 39 26 69 6d austria=4369 +9&im 0010 61 67 65 2e 78 3d 30 26 69 6d 61 67 65 2e 79 3d age.x=0&imag +e.y= 0020 30 0 Frame 10 (294 on wire, 294 captured) .. Hypertext Transfer Protocol HTTP/1.1 302 Found\r\n Date: Wed, 07 Aug 2002 10:15:45 GMT\r\n Server: Apache/1.3.26 (Unix) PHP/4.2.1\r\n X-Powered-By: PHP/4.2.1\r\n Location: /sms/index.php3\r\n Connection: close\r\n Transfer-Encoding: chunked\r\n Content-Type: text/html\r\n \r\n Data (5 bytes) 0000 30 0d 0a 0d 0a 0....

      I don't think the fact that the TCP stream is fragmented into multiple packets is likely to be causing your problem.

      One possibility is that the server logic expects a referer header:

      Referer: http://subscriber.chello.at/sms/index.php3
      I've got it!

      The servers denied to go on unless the correct Referer is entered in the header. LWP does not do by it self.

      Thanks for your hints,
      Carl

Re: Re: Re: Re: submit Form with Lynx but not Perl?
by Anonymous Monk on Aug 07, 2002 at 09:02 UTC
    Thanks,
    I'll try tcpdump - that means lol (=lot of lines).

    I'll let you know, if you are interested,
    Carl
    (carl.schreiber@web.de)