severndigital Posted July 23, 2009 Share Posted July 23, 2009 I have an XML reponse from a server using fsockopen(). the response includes the headers, which I don't need. what is the easiest way to remove all the of the content before the <?xml chars?? Thanks, -P Link to comment https://forums.phpfreaks.com/topic/167155-solved-removing-everything-before/ Share on other sites More sharing options...
severndigital Posted July 23, 2009 Author Share Posted July 23, 2009 FIgured it out. here it is for anyone else probably not the cleanest way .. but it's working //removing evertything before the <?xml $headers = substr($string,0,stripos($string,"<?xml")); $string = str_replace($headers,'',$string); //then we remove anything after the last > just to be safe. $string = substr($string,0,(strrpos($string,">")+1)); Link to comment https://forums.phpfreaks.com/topic/167155-solved-removing-everything-before/#findComment-881413 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.