htzone Posted June 17, 2009 Share Posted June 17, 2009 So, I'm using fsockopen/fgets to grab an xml file. The transfer encoding coming to me is chunked, so every so often there's a crap line in the middle of the file that I need to get rid of. Here's an example of the data: <SomeXML/>blarg</SomeXML> 0fe8 <SomeOtherXML>blah</SomeOtherXML> <MoreXML>zing</MoreXML> Here's the relevant code, for now: while (!feof($fp)) { if (strpos(fgets($fp), '<') === FALSE) { continue; } $response .= fgets($fp); } The strpos bit there does work - the HTTP headers don't show up when I use it - but the '0fe8' (and other similar values) still show. The weird thing is that the first occurrence of that value does get nixed (before the XML starts), but subsequent ones do not. Is this some new line/end of line thing? Could anyone shed some light on why this isn't working 100% of the time? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.