Does anyone have a suggestion on how to remove the first line of the below outputted xml so Magic Parser will read it correctly? I don't have access to their php so I will need to do this on my own.
http://www.livetheaction.com/motioncode/motioncodev2list.php?export=xml
Thanks a lot for anyones help!
Chris
Thanks! I actually just found my registration code and downloaded the new version. I can't seem to get this to work, it says there is a error on line 4... I can't see anything wrong though, do you see anything?
Thanks again,
Chris
Hi Chris,
Sure, the trick here is to read the XML into a string, and then use PHP's string functions to locate the start of the XML, and strip any preceeding text, for example:
<?php
require("MagicParser.php");
function myRecordHandler($record)
{
print_r($record);
return TRUE; // stop parsing
}
$url = "http://www.livetheaction.com/motioncode/motioncodev2list.php?export=xml";
$xml = file_get_contents($url);
$pos = strpos($xml,"<?xml");
$xml = substr($xml,$pos);
MagicParser_parse("string://".$xml,"myRecordHandler");
?>
However, I notice that you have been a Magic Parser user for a long time, and the string:// support was only added quite recently, so you may need to download the latest version in order to use this method.
If you have lost your registration code, drop me an email and i'll resend your code...
All the best!
David.