but the goal is not to determine whether or not the term "curl" is in the url, the goal is to prevent the page from being remotely accessed from a script that may or may not be using curl. also if i were to use curl commands in a file named foo.php, the remote download will still work because curl is not the url of the referer. plus the php script could use curl or something like it to send out an incorrect referer.
Main Topics
Browse All Topics





by: slyongPosted on 2007-06-04 at 20:52:48ID: 19214301
You can use the User-Agent string of curl to detect it:
])) != 0) {
if (preg_match('/curl/i', $_SERVER['HTTP_USER_AGENT'
die();
}
However, you have to include or require that into all your php files, the simpler way is to use Apache's mod_setenvif:
setenvif user-agent ^curl goaway
<Limit GET POST>
Order Allow,Deny
Allow from all
Deny from env=goaway
</Limit>