Question

I'm reading a rss feed and I get an image url and now I want to store this image in my folder. For this I'm using

$image=$movies->channel->item[i]->medium_image_url;

when I

echo $image

it shows http://showmycode.co.in/supermob/app/webroot/img/uploads/product_images/medium/0a646_Bombay-Biryani1.jpg

then I put I $url

$url = '$image';

$img = 'images/'.time().'.'.'jpg';
file_put_contents($img, file_get_contents($url));

and I

echo $url its show  only $image;

and I found a error

Warning: file_get_contents($image) [function.file-get-contents]: failed to open stream:
               No such file or directory in D:\wamp\www\test_om\rss\rssfeed.php on line 36

How can I store this image?

Was it helpful?

Solution

I think the error is here:

$url = '$image';

Remove the quotes and try this instead:

$url = $image;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top