我有一段代码旨在接收任何 URL 并将其从网络上删除。到目前为止,它一直运行良好,直到有人给它这个 URL:
http://www.aspensurgical.com/static/images/aspen_hill-rom_logo.png
如果我从浏览器中点击它,它显示得很好。但是当我尝试将它卷曲时,我得到:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /static/images/aspen_hill-rom_logo.png
on this server.</p>
<hr>
<address> Server at www.aspensurgical.com Port 80</address>
</body></html>
我正在使用的 CURL 代码是:
$ch = curl_init(str_replace(' ', '%20', $url));
$fh = fopen($local_file, "w");
curl_setopt($ch, CURLOPT_FILE, $fh);
curl_exec($ch);
curl_close($ch);
他们的服务器是否以某种方式意识到我不是普通的浏览器并引导我?