-1
        
        php
        
        curl
        
      
      // remote.php on http://www.example.com/
<?php
function curl_access()
{ /*
  some codes here to detect
  this script accessed via
  curl or direct and returns $r.
  (without checking referrer or user agent)
  */
  return $r;
}
$curl_access = curl_access();
if ($curl_access)
{ echo 'Accessed via CURL';
} else
{ echo 'Direct access';
}
?>
// some file on a server
<?php
$h = curl_init();
curl_setopt($c, CURLOPT_URL, "http://www.example.com/remote.php");
curl_exec($c); // returns 'Accessed via CURL'
curl_close($c);
?>
Run Code Online (Sandbox Code Playgroud)