Page 1 of 1

Re: elements from a xml file

Posted: Mon Apr 07, 2014 2:34 am
by adicooldude
Hi,
try this

Code: Select all

if (file_exists('sample.xml')) {
	# The XML file with bad characters
	$filename = "sample.xml";
	
	# Read file contents to a variable
	$contents = file_get_contents($filename);
	try{
		$xml_response = new SimpleXmlElement($contents, LIBXML_NOCDATA);
		echo ($xml_response->server_ip)."\n";
		echo ($xml_response->domain)."\n";
		echo ($xml_response->license_key)."\n";
		echo ($xml_response->allowed)."\n";
		echo ($xml_response->used)."\n";
		echo ($xml_response->expire)."\n";
		echo ($xml_response->update)."\n";
		echo ($xml_response->check)."\n";
	}catch (Exception $e){
		echo $e;
	}
	
}