Why can't I use include to pull in a URL?

Can someone help me with a cron I’m trying to setup. Here is the cron path:

‘/usr/bin/php5 /home3/recordau/public_html/tools/cronApprovals.php’ >>cronErrors.log 2>&1

Here is cronApprovals.php

<?php

include ‘http://www.oil-testimonials.com/tools/approveUsers.php?action=sendAlerts&method=cron’;

?>

When I run this file I get:

Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home3/recordau/public_html/tools/cronApprovals.php on line 3

Warning: include(http://www.oil-testimonials.com/tools/approveUsers.php?action=sendAlerts&method=cron) [function.include]: failed to open stream: no suitable wrapper could be found in /home3/recordau/public_html/tools/cronApprovals.php on line 3

Warning: include() [function.include]: Failed opening 'http://www.oil-testimonials.com/tools/approveUsers.php?action=sendAlerts&method=cron' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /home3/recordau/public_html/tools/cronApprovals.php on line 3

Any suggestions?

Thanks!

The reason it’s not working is stated in the error melding:

URL file-access is disabled in the server configuration

You can’t access the file using a URL. Best is to include it directly, or attempt to download it using cURL.

Alternatively, you can ask your host to allow URL file access.

Use the lynx cron solution I posted in your other thread… if you want to open a URL from php, you have to use file:

<?php
$result = file_get_contents(“http://www.oil-testimonials.com/tools/approveUsers.php?action=sendAlerts&method=cron”);
?>

Or use curl.

Steve,

After changing my code to your recommendation, I now get the following error:

Warning: file_get_contents(http://www.oil-testimonials.com/tools/approveUsers.php?action=sendAlerts&method=cron) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 401 Authorization Required in /home3/recordau/public_html/tools/cronApprovals.php on line 3

It’s probably complaining that approveUsers.php is in a password protected directory so it’s not accessible to the outside world. This would normally make sense to me, except I have another cron file in the same directory that executes without needing authorization. Any more ideas?

Thanks!