If I open this .JS file (link text) in Browser I get back following in browser window:
var PHONE_CNT=2;var PHONE_CNT2=0;var PHONE_CNT3=0;var EMAIL_CNT=2;var SHOW_CNT=1795;var PH_c="";var PH_1=0;var PH_2=0;var PH_3=0;
PH_1 = "JUQyJUFCJThDJUM5JThFJUQzJTgzeSVDMiVEQyVCQ2ElQkUlREQlQz开发者_运维知识库glOUUlOTR6JUE2bSVCN3ElOUIlRTglQzQlQkYlODUlRDklQjIlQzglQjclQUE=";
If I open the same file using cURL or ?php (file_get_contents) then the content differs:
var PHONE_CNT=0;var PHONE_CNT2=0;var PHONE_CNT3=0;var EMAIL_CNT=0;var SHOW_CNT=1;var PH_c="";var PH_1=0;var PH_2=0;var PH_3=0;
PH_1 = "JUQyJUFCJThDJUM5JThGJUMyJTg0JTlBJUJBJUM3JUJEdSVDMCVDRCVDOCVFNSU4RiU3RiVBNiVBOSVCOCU4MyU5MCVEOA==";
The difference is PH_1 value. I tried to set different options for cURL but nothing helps. Any idea how to get .JS file content using cURL same as what I get when using browser.
Thank you in advace.
The server must be generating a different PH1 value based on some request parameters. You'll have to trace out the HTTP headers from both requests to see what causes the difference, e.g. setting up a local proxy such as http://www.fiddler2.com/fiddler2/ and making both requests through that.
It could be some combination of the user agent, accepts headers, cookies or the IP or country you're connecting from that's makign the difference - without knowing what the server logic is (or understanding what the different PH1 values mean) we can't really help you sorry.
Curl just gets the data from the server, it does not interpret javascript. If you want to interpret the javascript from the webpage, you'll have to use a javascript engine as spidermonkey.
精彩评论