<?php $xml = '<rss version="2.0" xmlns:a10="http://www.w3.org/2005/Atom"> <channel> <title>mMin title</title> <description>Some description</description> <managingEditor>john.doe@example.com</managingEditor> <category>Some category</category> <item> <guid isPermaLink="false">1</guid> <link>https://example.com/1</link> <title>Some title 1</title> <a10:updated>2017-05-30T13:20:22+02:00</a10:updated> <a10:content type="text/xml"> <Location>San diego</Location> <PublishedOn>2016-10-21T11:21:07</PublishedOn> <Body>Lorem ipsum dolar</Body> <JobCountry>USA</JobCountry> </a10:content> </item> <item> <guid isPermaLink="false">1</guid> <link>https://example.com/2</link> <title>Some title 2</title> <a10:updated>2017-05-30T13:20:22+02:00</a10:updated> <a10:content type="text/xml"> <Location>Detroit</Location> <PublishedOn>2016-10-21T11:21:07</PublishedOn> <Body>Lorem ipsum dolar</Body> <JobCountry>USA</JobCountry> </a10:content> </item> <item> <guid isPermaLink="false">1</guid> <link>https://example.com/3</link> <title>Some title 3</title> <a10:updated>2017-05-30T13:20:22+02:00</a10:updated> <a10:content type="text/xml"> <Location>Los Angeles</Location> <PublishedOn>2016-10-21T11:21:07</PublishedOn> <Body>Lorem ipsum dolar</Body> <JobCountry>USA</JobCountry> </a10:content> </item> </channel> </rss>'; $dom = new DOMDocument(); $dom->loadXML($xml); $items = $dom->getElementsByTagName('item'); $array = array(); foreach($items as $item) { $title = $item->getElementsByTagName('title')->item(0)->nodeValue; $link = $item->getElementsByTagName('link')->item(0)->nodeValue; $updated = $item->getElementsByTagName('updated')->item(0)->nodeValue; $location = $item->getElementsByTagName('Location')->item(0)->nodeValue; $pub = $item->getElementsByTagName('PublishedOn')->item(0)->nodeValue; $body = $item->getElementsByTagName('Body')->item(0)->nodeValue; $job = $item->getElementsByTagName('JobCountry')->item(0)->nodeValue; $array[] = [ 'title' => $title, 'link' => $link, 'updated' => $updated, 'Location' => $location, 'PublishedOn' => $pub, 'Body' => $body, 'JobCountry' => $job, ]; } var_dump($array);
You have javascript disabled. You will not be able to edit any code.