I have this XML that i'm trying to import:
<products> <product product_id="62" title="Product Title" description="<p>desc</p>" price="40" brand="" weight="100" in_stock="Y"/> <product product_id="63" title="Product Title" description="<p>desc</p>" price="40" brand="" weight="100" in_stock="Y"/> </products>
I'm using Laravel 5 and this package: https://github.com/orchestral/parser
So i'm running this code:
$xml = XmlParser::load('https://www.url/feed.xml'); $product = $xml->parse([ 'product_id' => ['uses' => 'product::product_id'], 'title' => ['uses' => 'product::title'], 'description' => ['uses' => 'product::description'], ]); dd($product);
But it's just returning a single product in an array which isn't even the first or last one in the XML. So i'm a bit confused.
Anyone got any ideas?
Thanks.
No comments:
Post a Comment