Search the Community
Showing results for tags 'php parse array file'.
-
I know this should be fairly simple but I have having a really hard time understanding. I can parse html using tags and elements but I am not able to parse an array. I am loading an array from a file with the structure shown: <?php error_reporting(0); $items = array( array( "name" => "A&E", "number" => "", "id"=>"I265.28459333.microsoft.com", "country" => "United States", "url" => "68952", "url2" => "playlist.m3u8?xs=", "url3" => "playlist.m3u8?xs=", "url4" => "", "stream" => "http://streams/A&E.m3u8", "image" => "http://image/generic.png", "Guide" => "http://GUIDE/AE.xml", "liveguide" => "http:///streamguideXML/A&E.xml", "cid" => "9" ), array( "name" => "ABC", "number" => "", "id"=>"0", "country" => "United States", "url" => "46476", "url2" => "playlist.m3u8?xs=", "url3" => "playlist.m3u8?xs=", "url4" => "playlist.m3u8?xs=", "stream" => "http://ABC.m3u8", "image" => "http://image/generic.png", "Guide" => "http://GUIDE/ABCHD.xml", "liveguide" => "http://streamguideXML/ABC.xml", "cid" => "14" ), ?> I load the file by using file_get_contents but from there I am kinda of lost. I seem to think it's the way the file is structured that is confusing me but not sure. I have tried: $file=file_get_contents("http://channel_list.php"); foreach($items as $item){ $a=$item->cid; } But this doesn't work at all. I know the $file is populate, I can var_dump and shows everything. I want to pick out different elements but mainly the cid. If I could get some guidance to that I can take it from there. Thanks for any help.