Hi all -
I'm trying to use curl to fetch a page located on the same server. (Yes, I know this is absurd, but it's necessary, for reasons that aren't worth going into here.)
My code works fine with URLs on other servers, but any URL that begins with http://localhost/ returns an empty response.
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, 'http://localhost/testfile.php' );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
$output = curl_exec( $ch );
echo $output;
I've tried logging curl's activity, but the results are not helpful:
About to connect() to localhost:80
Closing connection #0
Any clues? Do I need to enable something in the Apache or PHP config file, perhaps? I've Googled, to no avail.