s-men Posted March 11, 2007 Share Posted March 11, 2007 I have a code in which you have to enter an html code and it extracts data from it etc... now the deal is that all html tags got to be gone except the < td > and < tr > because I'm using them to locate the data I need to extract. Now when you get the html code through internet explorer and you enter it (in any browser) on that page, it works perfect. When you get it through firefox then suddenly it's all seriously messed up, no matter in which browser you enter the code. Now after a small modifications to check what was the problem, I found out that the code received through firefox loses all the tags, even the td and tr even though I said not to. The only diffrence between the codes are some extra newlines, if I remove those manually it works. Very weird, anyway here a little extraction from the code: $html = substr($_POST['html'],strpos($_POST['html'],'killfiles') + 40); $html = strip_tags($html,'<td><tr>'); $html = str_replace(array("\r", "\n"), "+lul+", $html); the first line puts the string that was posted into a new one, but only from 31 chars after the first time killfiles appears till the end. the second line is supposed to strip all the tags except td and tr. the thirs line replaces all kinds of newlines and carried feeds to +lul+, so I can easy trace down where the newlines used to be. from this point it's all extracting data through recognation points in the code, which usually are the td and tr tags, but with them gone it's all messed up. I hope someine can see what the hell I'm doing wrong ^^ Link to comment https://forums.phpfreaks.com/topic/42266-strip_tags-problem/ Share on other sites More sharing options...
Glyde Posted March 12, 2007 Share Posted March 12, 2007 Try replacing: $html = strip_tags($html,'<td><tr>'); With: $html = strip_tags($html, array('tr', 'td')); php.net doesn't clearly explain what the second parameter should be. Link to comment https://forums.phpfreaks.com/topic/42266-strip_tags-problem/#findComment-205147 Share on other sites More sharing options...
s-men Posted March 12, 2007 Author Share Posted March 12, 2007 nope, it seems to get even worse ^^ thanks for trying though maybe there are some known differences between the sourcecode firefox shows and what internet explorer shows? if that were so and was predictible, maybe I could check which browser is being used and then adjust the code for known abnormalities. but I'm just some guy who's messes arounds with strings and other easy stuff, so if someone could point me in a good dirrection I would be happy Link to comment https://forums.phpfreaks.com/topic/42266-strip_tags-problem/#findComment-205175 Share on other sites More sharing options...
redarrow Posted March 12, 2007 Share Posted March 12, 2007 <?php $a=" hello <tr>there i am <tr><td> redarrow"; $html = str_replace("<td><tr>","",$a); echo $html; ?> Link to comment https://forums.phpfreaks.com/topic/42266-strip_tags-problem/#findComment-205240 Share on other sites More sharing options...
s-men Posted March 12, 2007 Author Share Posted March 12, 2007 td and tr tags have to stay, and besides your code example isn't replacing anything since they are not the same in the str_replace and in $a I just need to get rid of input and <a> tags, which are all variable. The point in the end is that I'm wondering why it works with source from IE but not from FF Link to comment https://forums.phpfreaks.com/topic/42266-strip_tags-problem/#findComment-205310 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.