New to XML and need some help extracting media:* namespace values



I need to extract 3 things from each item of an xml rss feed from Zazzle's api


here is the feed


http://ift.tt/1s6JuhD


I need to get the title,price, thumbnail,and guid (link) from each item and add it to an array. i plan to encode this array to json so i can fetch it with ajax and build the store view.


Can anyone give me some pointers of what i should do? i've tried using foreach and reading the documentation but i'm failing to understand how i can get the values for each item, it seems not to work no matter what i try.


here is what i have so far code wise:



$xml = simplexml_load_file('http://ift.tt/1s6JuhD');
echo '<pre>';
//echo json_encode($xml);
foreach($xml as $child){
$new[] = [
'img'=>(string)$child->attributes()->url,// ???
'link'=>,
'price'=>,
];
}
print_r($xml, false);

No comments:

Post a Comment