Simple XML in PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



HI all,


How would a get this video from XML.

/***********Example i want to View***********/
<media:content url="http://video-cdn.abcnews.com/090324_gma_leamy.flv";
lang="en" width="424" height="318" type="video/x-flv" />
/**************************************/


/**********************XML CODE***********************/
<title>Investigating Toxic Drywall</title>
<link>http://feedproxy.google.com/~r/AbcNews_Health_Videos/~3/d5ewEbco-js/playerIndex</link>
<description>China-made drywall could be leaching noxious gases into
homes.&lt;img
src="http://feeds2.feedburner.com/~r/AbcNews_Health_Videos/~4/d5ewEbco-js";
height="1" width="1"/&gt;</description>
<pubDate>Tue, 24 Mar 2009 10:20:04 -0400</pubDate>
<live:origReleaseDate>Tue, 24 Mar 2009 10:20:04 -0400</live:origReleaseDate>
<media:title>Investigating Toxic Drywall</media:title>
<media:description>China-made drywall could be leaching noxious gases into
homes.</media:description>
<media:keywords>drwall, toxic, china, building, house,
health</media:keywords>
<media:rating>nonadult</media:rating>
<media:thumbnail
url="http://a.abcnews.com/images/GMA/abc_gma_leamy_090324_mn.jpg";
width="320" height="240" /> 
<media:thumbnail
url="http://a.abcnews.com/images/GMA/abc_gma_leamy_090324_mc.jpg";
width="100" height="75" /> 
<media:thumbnail
url="http://a.abcnews.com/images/GMA/abc_gma_leamy_090324_mv.jpg";
width="264" height="198" /> 
<media:content url="http://video-cdn.abcnews.com/090324_gma_leamy.flv";
lang="en" width="424" height="318" type="video/x-flv" />
<media:category>Health</media:category>

/*********************PHP CODE EXAMPLE******************/

$cnt = count($xml->channel->item);
for($i=0; $i<$cnt; $i++)
{
$url 	= $xml->channel->item[$i]->link;
$title = $xml->channel->item[$i]->title;
$desc = $xml->channel->item[$i]->description;
$pubDate = $xml->channel->item[$i]->pubDate;


echo ' '.$url.' '.$title.' ';
echo "<br />";
echo $desc;
echo "<br />";
echo $pubDate;
echo "<br />";
echo "<br />";

}
 	

-- 
View this message in context: http://www.nabble.com/Simple-XML-in-PHP-tp22690831p22690831.html
Sent from the PHP - General mailing list archive at Nabble.com.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux