in reply to Can't able to get source page 500 error.

Hi, I don't know what your code is all about: you mention Mech but the code does not show it. I also don't know about your 500 error: that might be LWP not supporting 405 which is the code the site returns.

In any case, that page requires JavaScript to be enabled. WWW::Mechanize does not support JavaScript. Perhaps you can get around it by filling the CAPTCHA returned?

Using something more modern and simple to see what's going on:

use strict; use warnings; use feature 'say'; use Path::Tiny; use HTTP::Tiny; use HTTP::CookieJar; my $jar_file = Path::Tiny->tempfile; $jar_file->touch; my $jar = HTTP::CookieJar->new->load_cookies( $jar_file->lines ); my $ua = HTTP::Tiny->new( cookie_jar => $jar ); my $url = 'https://camelcamelcamel.com'; my $res = $ua->get( $url ); say $res->{'status'}; say $res->{'content'}; __END__
Output:
405 [ snip ] <p> As you were browsing <strong>camelcamelcamel.com</ +strong> something about your browser made us think you were a bot. Th +ere are a few reasons this might happen: </p> <ul> <li>You're a power user moving through this websit +e with super-human speed.</li> <li>You've disabled JavaScript in your web browser +.</li> <li>A third-party browser plugin, such as Ghostery + or NoScript, is preventing JavaScript from running. Additional infor +mation is available in this <a title='Third party browser plugins tha +t block javascript' href='http://ds.tl/help-third-party-plugins' targ +et='_blank'>support article</a>.</li> </ul> <p>After completing the CAPTCHA below, you will immedi +ately regain access to camelcamelcamel.com.</p> [ snip ]

Hope this helps!


The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^2: Can't able to get source page 500 error.
by sugu (Initiate) on Jun 08, 2017 at 13:38 UTC

    I saying that if I running this code it shows 500 error and i didn't use mechanize in this script but even i use mechanize also i can't get the source page.Someone try to get source page for this site i have know how to get source page of this site.<\p>

      Er, did you actually read my reply?

      1. The page requires Javascript.
      2. Neither LWP::UserAgent nor WWW::Mechanize support Javascript.
      3. Thus, your approach can not work.
      If you want to try to accomplish your task in Perl, you could look at Selenium::Remote::Driver, but that would require installing a headless browser on your system. Or, you could choose to accomplish your task without Perl using PhantomJS. Either way, you have a lot of work and learning ahead of you.


      The way forward always starts with a minimal test.

        I maintain a zoo of Javascript-enabled WWW::Mechanize work-alikes, WWW::Mechanize::PhantomJS, WWW::Mechanize::Firefox and WWW::Mechanize::Chrome. These might or might not help with accessing that site, depending on the real cause for the 500 error.

        Personally, I don't think the 500 error stems from not having Javascript but more likely stems from an invalid HTTPS certificate.