使用curl方法从RSS提要获取图像路径

Hello Sir I am trying to fetch image Path from RSS Feed using curl method ... I tried this code but its not working ... please help !!!!

<?php 
$feed = "http://feeds.bbci.co.uk/news/uk/rss.xml";

// Use cURL to fetch text
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $feed);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_USERAGENT, $useragent);
$rss = curl_exec($ch);
curl_close($ch);

// Manipulate string into object
$rss = simplexml_load_string($rss);

$siteTitle = $rss->channel->title;
echo "<h1>".$siteTitle."</h1>";
echo "<hr />";

$cnt = count($rss->channel->item);

for($i=0; $i<10; $i++)
{
    $images = $rss->channel->thumbnail->xpath('url');
    echo "Image Path : ".$image;
    echo "</br>";
}

?> 

In the source code of http://feeds.bbci.co.uk/news/uk/rss.xml i doesnt see thumbnail child in channel node.

If you want to get channel image try

$rss->channel->image->url

If you are a beginner with rss and want to parse more sites try use SimplePie library. Is very easy to use and implements more atom/rss secifications.

 <?php 
            $feed = "http://feeds.bbci.co.uk/news/uk/rss.xml";
            // Use cURL to fetch text
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $feed);
            curl_setopt($ch, CURLOPT_HEADER, 0);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            $rss = curl_exec($ch);
            curl_close($ch);
            // Manipulate string into object
            $rss = simplexml_load_string($rss);
            $siteTitle = $rss->channel->title;
            $cnt = count($rss->channel->item);
            for($i=0; $i<14; $i++){
                $url = $rss->channel->item[$i]->link;
                $title = $rss->channel->item[$i]->title;
    $image = $rss->channel->item[$i]->children('media', true)->thumbnail->attributes()->url;

  echo $image;
  echo "<br>";
  echo $title;
} ?>