I am attempting to use the file_get_contents function to print the contents of an image url on the screen:
<?php
$image2 = "http://www.example.com";
echo file_get_contents( $image2 );
?>
When run, the page takes about 15-20 seconds to load, then displays nothing. I've also attempted to use cURL, which gave the same result. Anyone have any suggestions on how to fix this?
Here is the curl code that I tried:
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://www.example.com");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$contents=curl_exec($ch);
curl_close($ch);
echo $contents;
?>
When run, the page keeps loading until the server cancels the request.