pkumar.pr has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Mechanize Help
by ikegami (Patriarch) on Jun 30, 2010 at 05:51 UTC

    Well, find out what the browser sends. Match what the browser sends.

    For one thing, the browser wouldn't be sending an invalid url. (Note the space.)

Re: Mechanize Help
by marto (Cardinal) on Jun 30, 2010 at 06:27 UTC

    This is the third time you've posted this (first in your previous thread then again anonymously Reaped: Mechanize Help). Please remember to login and don't post the same question multiple times. You don't need to start a new thread when one already exists for the same problem.

      I am new to perlmonk and I didn't realize that I got logged out. Also I was unable to track my previous post. So accidentally I made anonymous post. Even anonymous post post was not visible to me and then I realized that I have been logged out. So Again I logged in and posted my question. Sorry for accidentally spamming.

        Welcome to the Monastery. A few things. When posting without logging in you actually get prompted to do so at after the 'preview' stage:

        You aren't logged in.

        Login, Create a new user, or hit "Create" to proceed in posting your node.

        It's pretty hard to miss. If you aren't logged in you don't get to see posts which are yet to be approved. Once logged in you receive a message when someone replies to your post. Perhaps you should spend some time familiarising yourself with the monastery. See Understanding and Using PerlMonks from the tutorials section of the site.

Re: Mechanize Help
by Khen1950fx (Canon) on Jun 30, 2010 at 09:03 UTC
    I used a shorter version of the url. This'll show you the html on STDOUT, or uncomment the open to save to log.
    #!usr/bin/perl use strict; use warnings; use LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->timeout(2); $ua->env_proxy; my $response = $ua->get('http://www.justdial.com'); #open(STDOUT, '>', 'just_dial.html'); if ($response->is_success) { print $response->decoded_content; } else { die $response->status_line; }

      For saving content, there also is the convenient ->save_content method. This also saves you the binmode call on STDOUT if you're trying to save binary data.

Re: Mechanize Help
by pkumar.pr (Initiate) on Jun 30, 2010 at 06:25 UTC

    Sorry the url is

    $base_url = 'http://search.justdial.com/srch/search_cwa.php?srch=true& +city=Chennai%20result=&city=&searchtype=Multicuisine+Restaurants&resu +ltType=&area=&new_area=&Stype=category&choices=&intermid=true&docId=& +smsAlert=&emailAlert=&NameAlert=&sinfo=&smsDetail=&img=&img_check=&se +eAlso=&sms_visible=&sms_button=&Lowcat=&lowest=&return_page=&magic_mo +bile=&magic_email=&magic_sinfo=&magic_Detail=&magic_seeAlso=&magic_na +me=&magic_tel=&login_name=&login_pass=&login_name_review=&login_pass_ +review=&img_forget=&screen_name=&login_name1=&login_pass1=&comp=&cid= +&review_div=&ADVSEARCH=&city=Chennai&txtname=&txtadd=&Street=&area=&P +in=&txt_company=&txtphone=&jdG=&search_type_string_company=&search_ty +pe_string=';

    Header looks like this

    http://search.justdial.com/srch/search_cwa.php?srch=ture&city=Chennai POST /srch/search_cwa.php?srch=ture&city=Chennai HTTP/1.1 Host: search.justdial.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6 +) Gecko/20100625 Firefox/3.6.6 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://search.justdial.com/srch/search_cwa.php?srch=true&city +=Chennai%20result=&city=&searchtype=Multicuisine+Restaurants&resultTy +pe=&area=&new_area=&Stype=category&choices=&intermid=true&docId=&smsA +lert=&emailAlert=&NameAlert=&sinfo=&smsDetail=&img=&img_check=&seeAls +o=&sms_visible=&sms_button=&Lowcat=&lowest=&return_page=&magic_mobile +=&magic_email=&magic_sinfo=&magic_Detail=&magic_seeAlso=&magic_name=& +magic_tel=&login_name=&login_pass=&login_name_review=&login_pass_revi +ew=&img_forget=&screen_name=&login_name1=&login_pass1=&comp=&cid=&rev +iew_div=&ADVSEARCH=&city=Chennai&txtname=&txtadd=&Street=&area=&Pin=& +txt_company=&txtphone=&jdG=&search_type_string_company=&search_type_s +tring= Cookie: __utma=98395136.816878539.1277791627.1277873550.1277877109.5; +__utmz=98395136.1277877109.5.2.utmcsr=search.justdial.com|utmccn=(ref +erral)|utmcmd=referral|utmcct=/; CITY=Chennai; PHPSESSID=987c70fa00fe +82b9c7c1ca9add436cf0; __utmc=98395136; __utmb=98395136.22.10.12778771 +09; showFlash=1 Content-Type: application/x-www-form-urlencoded Content-Length: 141 city=Chennai&searchtype=51778%2C314625%2C310563%2C310549%2C310573%23%2 +3Multicuisine+Restaurants&area=&Stype=category&intermid=true&proximit +y= HTTP/1.1 200 OK Date: Wed, 30 Jun 2010 06:24:23 GMT Server: Apache Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: private, max-age=10800, pre-check=10800 Last-Modified: Thu, 27 May 2010 16:44:24 GMT Keep-Alive: timeout=2, max=100 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html ---------------------------------------------------------- http://search.justdial.com/srch/Code_srch/security-image.php GET /srch/Code_srch/security-image.php HTTP/1.1 Host: search.justdial.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6 +) Gecko/20100625 Firefox/3.6.6 Accept: image/png,image/*;q=0.8,*/*;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: 115 Connection: keep-alive Referer: http://search.justdial.com/srch/search_cwa.php?srch=ture&city +=Chennai Cookie: __utma=98395136.816878539.1277791627.1277873550.1277877109.5; +__utmz=98395136.1277877109.5.2.utmcsr=search.justdial.com|utmccn=(ref +erral)|utmcmd=referral|utmcct=/; CITY=Chennai; PHPSESSID=987c70fa00fe +82b9c7c1ca9add436cf0; __utmc=98395136; __utmb=98395136.22.10.12778771 +09; showFlash=1 HTTP/1.1 200 OK Date: Wed, 30 Jun 2010 06:24:27 GMT Server: Apache Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre- +check=0 Pragma: no-cache Content-Length: 841 Keep-Alive: timeout=2, max=100 Connection: Keep-Alive Content-Type: image/gif ---------------------------------------------------------- http://www.google-analytics.com/__utm.gif?utmwv=4.7.2&utmn=730282458&u +tmhn=search.justdial.com&utmcs=ISO-8859-1&utmsr=1360x768&utmsc=24-bit +&utmul=en-us&utmje=1&utmfl=10.0%20r45&utmdt=Just%20Dial%20-%20India%2 +7s%20No.1%20local%20search%20engine&utmhid=26967521&utmr=0&utmp=%2Fsr +ch%2Fsearch_cwa.php%3Fsrch%3Dture%26city%3DChennai&utmac=UA-1220997-2 +&utmcc=__utma%3D98395136.816878539.1277791627.1277873550.1277877109.5 +%3B%2B__utmz%3D98395136.1277877109.5.2.utmcsr%3Dsearch.justdial.com%7 +Cutmccn%3D(referral)%7Cutmcmd%3Dreferral%7Cutmcct%3D%2F%3B GET /__utm.gif?utmwv=4.7.2&utmn=730282458&utmhn=search.justdial.com&ut +mcs=ISO-8859-1&utmsr=1360x768&utmsc=24-bit&utmul=en-us&utmje=1&utmfl= +10.0%20r45&utmdt=Just%20Dial%20-%20India%27s%20No.1%20local%20search% +20engine&utmhid=26967521&utmr=0&utmp=%2Fsrch%2Fsearch_cwa.php%3Fsrch% +3Dture%26city%3DChennai&utmac=UA-1220997-2&utmcc=__utma%3D98395136.81 +6878539.1277791627.1277873550.1277877109.5%3B%2B__utmz%3D98395136.127 +7877109.5.2.utmcsr%3Dsearch.justdial.com%7Cutmccn%3D(referral)%7Cutmc +md%3Dreferral%7Cutmcct%3D%2F%3B HTTP/1.1 Host: www.google-analytics.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6 +) Gecko/20100625 Firefox/3.6.6 Accept: image/png,image/*;q=0.8,*/*;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: 115 Connection: keep-alive Referer: http://search.justdial.com/srch/search_cwa.php?srch=ture&city +=Chennai HTTP/1.1 200 OK Date: Tue, 29 Jun 2010 21:04:01 GMT Content-Length: 35 Pragma: no-cache Expires: Wed, 19 Apr 2000 11:43:00 GMT Last-Modified: Wed, 21 Jan 2004 19:51:30 GMT Content-Type: image/gif Server: Golfe Cache-Control: private, no-cache, no-cache=Set-Cookie, proxy-revalidat +e ----------------------------------------------------------
      Why did you post three requests? Why are none of them are for the url you say you want to fetch?