HTTP::Request::Common Post problem

Discussion in 'Perl Misc' started by matlaw@gmail.com, Nov 6, 2006.

  1. Guest

    I'm trying to Post to a web site using the following code:

    >#!/usr/bin/perl


    >use HTTP::Request::Common qw(POST);
    >use LWP::UserAgent;
    >$ua = LWP::UserAgent->new;


    >my $req = POST 'http://www.sfarmls.com/scripts/mgrqispi.dll',
    > [ APPNAME => 'Sanfrancisco',
    > PRGNAME => 'MLSLogin',
    > ARGUMENTS => ('-ASS','-AA'),
    > ];


    >print $ua->request($req)->as_string;


    But when I do, I get an HTML file from www.sfarmls.com telling me that
    I'm using an invalid entry point.

    However, I can easily access this site with the following telnet
    commands:

    >POST /scripts/mgrqispi.dll HTTP/1.1
    >Host: www.sfarmls.com
    >Content-Length: 56
    >Content-Type: application/x-www-form-urlencoded


    >APPNAME=Sanfrancisco&PRGNAME=MLSLogin&ARGUMENTS=-ASS,-AA


    Can anyone tell me what I'm doing wrong?

    Thanks,

    Matt
     
    , Nov 6, 2006
    #1
    1. Advertising

  2. zentara Guest

    On 5 Nov 2006 20:22:43 -0800, wrote:

    >I'm trying to Post to a web site using the following code:
    >
    >>#!/usr/bin/perl

    >
    >>use HTTP::Request::Common qw(POST);
    >>use LWP::UserAgent;
    >>$ua = LWP::UserAgent->new;

    >
    >>my $req = POST 'http://www.sfarmls.com/scripts/mgrqispi.dll',
    >> [ APPNAME => 'Sanfrancisco',
    >> PRGNAME => 'MLSLogin',
    >> ARGUMENTS => ('-ASS','-AA'),
    >> ];

    >
    >>print $ua->request($req)->as_string;

    >
    >But when I do, I get an HTML file from www.sfarmls.com telling me that
    >I'm using an invalid entry point.
    >
    >However, I can easily access this site with the following telnet
    >commands:
    >
    >>POST /scripts/mgrqispi.dll HTTP/1.1
    >>Host: www.sfarmls.com
    >>Content-Length: 56
    >>Content-Type: application/x-www-form-urlencoded

    >
    >>APPNAME=Sanfrancisco&PRGNAME=MLSLogin&ARGUMENTS=-ASS,-AA

    >
    >Can anyone tell me what I'm doing wrong?


    Have you tried capturing the transfers with something like ethereal or
    tcpick, and seeing what is actually being sent?

    Just glancing at syntax, I zeroed in on

    ARGUMENTS => ('-ASS','-AA'),
    vs.
    &ARGUMENTS=-ASS,-AA

    as looking quite susceptible to different interpretations.

    maybe try
    ARGUMENTS => ['-ASS','-AA'],
    or
    ARGUMENTS => '-ASS, -AA',

    ? just guessing :)



    --
    I'm not really a human, but I play one on earth.
    http://zentara.net/japh.html
     
    zentara, Nov 6, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sure
    Replies:
    1
    Views:
    609
    Jim Gibson
    Sep 2, 2004
  2. Replies:
    6
    Views:
    6,049
    Tor Iver Wilhelmsen
    Aug 29, 2005
  3. James
    Replies:
    3
    Views:
    16,617
    Roedy Green
    Nov 25, 2005
  4. Replies:
    9
    Views:
    283
    Charles DeRykus
    Mar 14, 2006
  5. Alex
    Replies:
    1
    Views:
    181
    Gunnar Hjalmarsson
    Mar 20, 2006
Loading...

Share This Page