简体   繁体   中英

PHP rel=NOFOLLOW

I want to download files, from an website using PHP.

And i want to create an php script to download files without going on their website to download files. I just want to pun their link on my script an download the file automatically.

I try with CURL, but doesn't work.... The link is like this <a rel="nofollow" href="/download-15866-114621.srt"><b>Download</b></a>

the code :

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,
  'http://subtitrari.regielive.ro/download-15866-114621.srt');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$contents = curl_exec ($ch);
echo $contents;
curl_close ($ch);

I get "download failed!" as content, which means they probably have some sort of download protection. The best thing is probably to ask them what you should do (assuming you have their permission to download the file) or stop trying (assuming you don't).

Eitherway, try setting a referer header with CURLOPT_REFERER. Maybe they check that header to see that no-one is hotlinked to the file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM