hello i have read a page source using fopen() and get the part of that content in to a variable. like this; $fh = fopen("http://myurl.com", "r"); $fullstring; while(!feof($fh)) { $output = htmlspecialchars(fgets($fh, 1024)); $fullstring = $fullstring."".$output; } $section_from_the_source = get_string_between(...................) echo $section_from_the_source; //get_string_between() is user written function. //$section_from_the_source [B]contains [/B]<table><tr><td>INFORMATION</td></tr></table> Code (markup): but when i display that variable it just shows this text. NOT the actual table. Display as; (Note that i hv read this using fopen) <table><tr><td>INFORMATION</td></tr></table> if i do something like this, it shows the actual table $test_variable = "<table><tr><td>INFORMATION</td></tr></table>"; echo $test_variable; //This Shows the actual table. Code (markup): Help need to solve this.
most probably you need to use htmlentities() decoding function to make it interprete the code as html
htmlentities : <?php $mytext = "<b>This should be in bold</b>"; echo htmlentities($mytext); // no more bold text .. <b> tags will be printed out as a plain text .. ?> PHP:
Remove htmlspecialchars on your code and you will have the exact content readed from the url. You can look at the source of the html you generated and you can see that the "<" symbol is not printed, instead, it's html representation (I don't remember the exact) Is like a space, that is printed like ' ' Don't use the htmlspecialchars and I think your problem is solved. Please, reply if this doesn't work