@wallstreet; buyrun hocam

<?php

	$url = "http://abc.def.com/mp/sitemap.xml";

	$response = file_get_contents($url);

	$document = new DOMDocument();

	$document->preserveWhiteSpace = false;

	$document->loadXML($response);

	$data = array('urlset' => array());

	foreach($document->getElementsByTagname('url') as $url)
	{
		$index = 0;

		$loc = $url->getElementsByTagName('loc')->item($index)->nodeValue;
		$priority = $url->getElementsByTagName('priority')->item($index)->nodeValue;
		$changefreq = $url->getElementsByTagName('changefreq')->item($index)->nodeValue;

		$namespace = 'http://www.google.com/schemas/sitemap-image/1.1';

		$images = array();

		$imageIndexKeys = array_keys(range(1, $url->getElementsByTagNameNS($namespace, 'image')->length));

		foreach($imageIndexKeys as $imageIndex)
		{
			$images[] = array(
				'loc' => $url->getElementsByTagNameNS($namespace, 'loc')->item($imageIndex)->nodeValue,
				'caption' => $url->getElementsByTagNameNS($namespace, 'caption')->item($imageIndex)->nodeValue,
				'title' => $url->getElementsByTagNameNS($namespace, 'title')->item($imageIndex)->nodeValue
			);
		}

		$data['urlset'][] = array(
			'loc' => $loc,
			'priority' => $priority,
			'changefreq' => $changefreq,
			'image' => $images
		);
	}

	print_r($data['urlset'][0]['image'][0]['caption']); // SND703P