2011-11-04 64 views
0

我正在閱讀RSS源並獲取圖像URL,現在我想將此圖像存儲在我的文件夾中。對於這個我使用在變量中訪問圖像網址

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

當我

echo $image 

它顯示http://showmycode.co.in/supermob/app/webroot/img/uploads/product_images/medium/0a646_Bombay-Biryani1.jpg

然後我把我$url

$url = '$image'; 

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

echo $url its show only $image; 

,我發現了一個錯誤

警告:的file_get_contents($圖像)function.file-GET-內容]: 未能打開流:
                             第36行D:\ wamp \ www \ test_om \ rss \ rssfeed.php中沒有這樣的文件或目錄

如何儲存此圖像?

回答

3

我認爲錯誤是在這裏:

$url = '$image'; 

刪除引號,並嘗試這個:

$url = $image; 
+0

感謝,很多of..its再次把我的5 hours..thankü – omnath