The rar external chain of a compressed package in an online storage has a referer anti-Leech detection function. for example, if the rar external chain of a compressed package in a php online storage has a referer detection anti-Leech function, I want to put it on my blog, attackers can download files directly. could you tell me how to forge a path, and then open and download files in rar format?
I am tossing the code http://bbs.csdn.net/topics/390842920, I feel bad
Reply to discussion (solution)
Counterfeit referer
Counterfeit referer
Code
$ Url = '/A connection address in url.rar format'; $ ch = curl_init (); // initialize curl_setopt ($ ch, CURLOPT_URL, $ url ); // The page you want to access curl_setopt ($ ch, CURLOPT_REFERER, 'a specific url '); // counterfeit the url curl_setopt ($ ch, CURLOPT_HEADER, 1 ); // read the http header curl_setopt ($ ch, CURLOPT_WRITEFUNCTION, 'func'); // listen to the returned data curl_exec ($ ch); // execute function func ($ ch, $ str) {static $ s = '@'; if ($ s) {$ s = trim ($ str); if ($ s) header ($ s ); // if it is the header information, send the corresponding header} else echo $ str; // otherwise, send the data return strlen ($ str );}
Since the other party provides download, the relevant information is provided, including the file name and file length.