As of recently when I look at my web statistics through AWStats, I see several things that concern me. The first is 'Unknown robot' listed under the 'Robots/spiders visitors' tab. The second, and most concerning line is 'A PHP script' under the same AWStats robots tab. I run content on my site that should not be fetched by other site's PHP scripts. Is there any way to log this in Apache logs? In other words, how can I tell if the script is being called by a PHP script (through logs or PHP functions)? Lastly, an image is listed below that shows what I'm describing. As you can see, hits from a normal bot - Googlebot - number in the hundreds whereas the hits from the 'Unknown robots' number roughly 700 thousand.

There's no 100% way to do it, as no matter what kind of script is connecting to your site, it can make it look like a browser so you will never know.
The only thing crossing my mind — they call "PHP script" requests that contain something specific in
$_SERVER['HTTP_USER_AGENT'], for example user agents starting withPHP/, likePHP/5.2.9.