If you have XML data you need to download, you can download it with file_get_contents($url), which will return file as a string. Then you use simplexml parser to parse through the XML.

You may need to add allow_url_fopen=1 to the php.ini to allow for the file download with file_get_contents.

<?php
$url = 'https://www.example.com/file.xml';
$xml_str = file_get_contents($url);
$xml_feed = simplexml_load_string($xml_str);
//then you can do a foreach on each row returned on the xml, like so..
foreach($xml_feed as $key => $data){
	
}
?>

Leave a Reply

Your email address will not be published. Required fields are marked *