in reply to What parameters should I send?

how do I pass the paramenter to the search?

There are two possible approaches: The first is to read the HTML (+javascript) source of the page, understand what it's doing, and emulate the same in Perl.

The second is to get a copy of the HTTP request that your browser sends when you submit the form. This can be done with tools like wireshark, or with the Live HTTP Headers extension for Firefox.

Replies are listed 'Best First'.
Re^2: What parameters should I send?
by brian123 (Novice) on Dec 06, 2010 at 23:23 UTC
    I downloaded LiveHttpHeader as you said and ran it. Here is the result that I got but am unable to determine the exact line that was sent, could you help me out please.
    http://www.sanmateocountytaxcollector.org/SMCWPS/SearchParcels POST /SMCWPS/SearchParcels HTTP/1.1 Host: www.sanmateocountytaxcollector.org User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.11) Gecko +/20101028 CentOS/3.6-2.el5.centos Firefox/3.6.11 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: 115 Connection: keep-alive Referer: http://www.sanmateocountytaxcollector.org/SMCWPS/pages/secure +Search.jsp Cookie: JSESSIONID=0000hccwV8X_iqYt4J9YpcxAwwC:-1 Content-Type: application/x-www-form-urlencoded Content-Length: 181 parcelNumber=048022230&searchType=parcel&listFirst=S&bkList=SS&address +TypeDsp=&addressType=&actionType=search&nextPage=.%2Fpages%2FparcelLi +st.jsp&parcel1=048&parcel2=022&parcel3=230
      parcelNumber=048022230&searchType=parcel&listFirst=S&bkList=SS&addressTypeDsp=&addressType=&actionType=search&nextPage=.%2Fpages%2FparcelList.jsp&parcel1=048&parcel2=022&parcel3=230

      That's the list of POST parameters and their values. If you replicate them, you should be fine.

        Hello,

        I rewrote my Perl script as follow:
        #!/usr/bin/perl -w use LWP::UserAgent; my $ua = LWP::UserAgent->new; # Create a request my $response = $ua->post('http://www.sanmateocountytaxcollector.org/SM +CWPS/SearchParcels',{parcelNumber=>'048022230',searchType=>'parcel',l +istFirst=>'S',bkList=>'SS',addressTypeDsp=>'',addressType=>'',actionT +ype=>'search',nextPage=>'. 2Fpages 2FparcelList.jsp',parcel1=>'048',p +arcel2=>'022',parcel3=>'230'}); my $content = $response->content; print $content;
        but it said
        <h1>The page cannot be found</h1> The page you are looking for might have been removed, had its name cha +nged, or is temporarily unavailable.

        when I ran it. What did I do wrong?