Copy text from remote url using php code

The following script to copy the text from remote url using php code.

 
(.*<\/body>/smi';

/*END config, BEGIN html*/

$data = file_get_contents($siteName) or die('Cannot read ' . $siteName);

preg_match($regex, $data, $cleanData);

if(!empty($cleanData))

$data = $cleanData[1];

echo $data;

?>

This is simple copy text from another site, but it will be useful for who are new to php.

Anil Kumar Panigrahi

With more than 10 years experience in PHP and Founder of Anil Labs, a blog for PHP and related posts. contributed posts regarding CodeIgniter, CakePHP and Learn PHP online ... Contact : [email protected]

You may also like...

1 Response

  1. Thanks, I’m working on a text parsing script for MySQL and this helped me out alot!!

Leave a Reply

Your email address will not be published. Required fields are marked *