Hello ,everybody
I use this browser named Mozilla Firefox to open this web page
http://www.tianyancha.com/company/398459114
,and I can see web
page information.
When use Httpfox to open this website http://www.tianyancha.com/company/398459114.json
,can see information too.
I want to obtain the web page information,I write these code as follow :
but shows {"state":"error","message":"","data":null}.
please tell me how to get to this web page information, thank you ~
use HTTP::Cookies;
use LWP::UserAgent;
use HTTP::Request::Common qw (GET POST);
$|=1;
my $ua=LWP::UserAgent->new(agent=>'Mozilla/5.0 (Windows NT 10.0; rv:46
+.0) Gecko/20100101 Firefox/46.0',timeout=>10);
my $cookie_jar=HTTP::Cookies->new();
$ua->cookie_jar($cookie_jar);
my %h=(
'Tyc-From'=>'normal',
'Accept-Encoding'=>'gzip, deflate',
'Accept'=>'application/json, text/plain, */*',
'Referer'=>'http://www.tianyancha.com/company/398459114'
);
my $ba=$ua->request(GET 'http://www.tianyancha.com/company/398459114.j
+son',%h)->as_string;
open(C,">test_get.txt") or die;
print C "$ba";
close C;
Hello! Thank you for soon reply !
Is there any better method of using Perl to get this web page or get JSON information ?
Must though http://antirobot.tianyancha.com/captcha/verify first ?
By the way ,if when access, download the authentication code, and then manually enter position, and then submit the manual input position through similar LWP module, access to web pages or JSON information?
Whether this method can be ok ? Kindly give me the suggestion ,thanks a lot ~
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.