Images dont load while fetching a web page!!


#1

$c = curl_init(‘http://shannon/’);
curl_setopt($c,CURLOPT_RETURNTRANSFER,1);
$page = curl_exec($c);
echo $page;
curl_close($c);

when i use the above code to fetch a url. the images on the url dont show up. why is this happening. i tried fopen and i still get the same problem!!
please help!

jose


#2

You could try fsockopen(), or do some magic with base64_encode() (I think … better check the manual for that).


#3

I think the reason is very simple - curl downloads only html code of the page (or other format if server returns something else). So, images should be downloaded separately, if you want to pack the page. Usually, if you are showing the page returned by the curl on your site, web browser is able to download missed images, but there can be some problems with proxy servers or when you allowed images from the same server only :wink: