[Solved] php explode on xml file


If what you are looking for is a way to cleanup the corrupt XML file, you can just add the string that gets missing when the explode is run. It is all a bit hackish, but it works.

$file="/Users/jasenburkett/Sites/jobsark/feed.xml";
$data = file_get_contents($file);

$split = "</JobSearchResults>";   // Split on this
$parts = explode($split, $data);  // Make the split
$cleanedXml = $parts[0];          // Use first part
$cleanedXml .= $split;            // Put back last ending tag

file_put_contents($file, $cleanedXml);

5

solved php explode on xml file