Return to Snippet

Revision: 87034
at September 14, 2021 12:11 by ollie101


Updated URL

                                

Revision: 29003
at July 19, 2010 07:44 by ollie101


Initial Code
//Get the contents of a specified tag ($tag) of the specified XML file ($xmlFile)
function getXmlData($xmlFile, $tag)
{
	$output = substr($xmlFile, strpos($xmlFile, "<".$tag.">") + strlen("<".$tag.">"), 
						strpos($xmlFile, "</".$tag.">")- strpos($xmlFile, "<".$tag.">") - strlen("<".$tag.">"));
	return $output;
}

Initial URL
http://www.olliesilviotti.co.uk

Initial Description
Simple piece of PHP to get the contents of a specified tag from an XML file and return it

Initial Title
Get the contents of a specified tag from an XML file in PHP

Initial Tags
php, xml

Initial Language
PHP