PDA

View Full Version : any php genius's?


earthman
01-12-2007, 12:35 PM
hi all,

Say i pull a large text from a database that i have called $code.

$code contains the source code from any random web page that i have got hold of using this script:

<?php

$code = file_get_contents("http://www.bbc.co.uk/");

?>

I want to then take $code and get rid of all the HTML and other tags etc, and leave me with all the text in there. To put it another way i want to get all the text out of $code and save it as $text.

How do i do this?

How do i select text that lies between to words, strings, or tags?

Cheers

McCoy
01-12-2007, 12:59 PM
$text = strip_tags($code);

That way you will get everything without the HTML tags.

earthman
01-12-2007, 03:10 PM
Thanks very much, thats a real help.