Forum Moderators: coopster

Message Too Old, No Replies

Is such a thing possible...

And if so, how?

         

BlueScreen

2:09 pm on Sep 11, 2004 (gmt 0)

10+ Year Member



I'd like a PHP script that takes a URL as a variable, then somehow gets the entire HTML source of that page. Then, it strips all HTML tags but <br> <p> <b> <a> <i> and <u> and then prints that to the page.

Is this possible?

Thanks a lot

mincklerstraat

2:33 pm on Sep 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, it's quite possible.
You need to look at the php functions file_get_contents() and strip_tags() (see second parameter on allowable tags) - and then echo or print, of course.

<?php
$filestring = @file_get_contents($_GET['url']);
if($filestring){
$filestring = strip_tags($filestring, '<br><p><a><i><u>');
echo $filestring;
} else echo 'error, probably bad url';
?>