Need PHP help....

Status
Not open for further replies.

bam bam

New member
Oct 9, 2007
962
11
0
I need to build a text-only generator.

I.e.

Take this website ------> Put it in the genreator -----> Strips out all CSS and Images -------> Displays end result.

I've got it to strip the CSS etc but i can't remove the images.

Thanks
 


At the minute i've got the most basic of basics working....

PHP:
<?php
$url = 'http://www.example.com';
$output = file_get_contents($url); 
echo $output;
?>
 
Additionally, I found this function in PHP manual (untested):

Code:
function html2txt($document){
$search = array('@<script[^>]*?>.*?</script>@si',  // Strip out javascript
               '@<style[^>]*?>.*?</style>@siU',    // Strip style tags properly
               '@<[\/\!]*?[^<>]*?>@si',            // Strip out HTML tags
               '@<![\s\S]*?--[ \t\n\r]*>@'        // Strip multi-line comments including CDATA
);
$text = preg_replace($search, '', $document);
return $text;
}
 
I think he was trying to point out that he works with php, mysql, postgresql and sqlite for a living :P and possibly that he builds content generators. ( see his sig )
 
Status
Not open for further replies.