任意の URL を受け取り、それを Web から切り取るように設計されたコードがあります。これまでのところ、誰かがこの 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);
彼らのサーバーは、私が通常のブラウザではないことを何らかの形で認識し、私を起動していますか?