The target website is: http://www.vlook.cn/app/square/category?r=re&catId=1156&no=4
The URL of ajax is: http://www.vlook.cn/ajx/n/square/category?cid=1156&scrollSpan=25&no=76&size=12&sid=3&rnd=0.5945953091140836
The URL loaded in each drop-down:
http://www.vlook.cn/ajx/n/square/category?cid=1156&scrollSpan=25&no=77&size=12&sid=3&rnd=0.4636393147520721
http://www.vlook.cn/ ajx/n/square/category?cid=1156&scrollSpan=25&no=78&size=12&sid=3&rnd=0.5662677509244531
http://www.vlook.cn/ajx/n/square/category?cid=1156&scrollSpan=25&no=80&size=12&sid= 3&rnd=0.9569658676628023
I don’t know how to get this ajax URL. The rnd=0.5945953091140836 parameter of the URL will change.
View the JS file: http://image.vlook.cn/js/v3/v106_vlk.square_category-min.js?ver =1.2.6
I didn’t find the rnd parameter, please tell me!
The target website is: http://www.vlook.cn/app/square/category?r=re&catId=1156&no=4
The URL of ajax is: http://www.vlook.cn/ajx/n/square/category?cid=1156&scrollSpan=25&no=76&size=12&sid=3&rnd=0.5945953091140836
The URL loaded in each drop-down:
http://www.vlook.cn/ajx/n/square/category?cid=1156&scrollSpan=25&no=77&size=12&sid=3&rnd=0.4636393147520721
http://www.vlook.cn/ ajx/n/square/category?cid=1156&scrollSpan=25&no=78&size=12&sid=3&rnd=0.5662677509244531
http://www.vlook.cn/ajx/n/square/category?cid=1156&scrollSpan=25&no=80&size=12&sid= 3&rnd=0.9569658676628023
I don’t know how to get this ajax URL. The rnd=0.5945953091140836 parameter of the URL will change.
View the JS file: http://image.vlook.cn/js/v3/v106_vlk.square_category-min.js?ver =1.2.6
I didn’t find the rnd parameter, please tell me!
url: http://www.vlook.cn/ajx/n/square/category?cid=1156&scrollSpan=25&no=2&size=12&sid=3
Parameters
no: Which page is it? The timestamp parameter can generally be removed. He does not participate in business logic
Just file_get_contents
$res = json_decode(file_get_contents("http://www.vlook.cn/ajx/n/square/category?cid=1156&scrollSpan=25&no=2&size=12&sid=3") ,1);
var_dump($res'rst');die;
Try it
rnd parameter is generally used to ensure that the request will not be cached. You can simulate and generate one. The server generally does not process this parameter.
The URL is fixed, you don’t need to look for it, just analyze other parameters. rnd is a random number, don’t worry about it. Just find the paging parameters.
By judging whether the scroll bar reaches the bottom, if the scroll bar reaches the bottom, the current page number and the parameters of how many pieces of data are loaded each time are passed to the background interface through ajax asynchronous request. The background interface then uses limit to perform paging query. Then return json data, and then the front end appends these json data to the original html container
ajax obtaining data from other domain names is a cross-site behavior and will be prohibited by the browser.