I need to extract three things from each item of an XML RSS feed from Zazzle's API.
Here is the feed: https://feed.zazzle.com/cityofhoops/rss
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.
How can I do this? 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 the code I have so far:
$xml = simplexml_load_file('http://feed.zazzle.com/cityofhoops/rss');
echo '<pre>';
//echo json_encode($xml);
foreach($xml as $child){
$new[] = [
'img'=>(string)$child->attributes()->url,// ???
'link'=>,
'price'=>,
];
}
print_r($xml, false);