Copy text from remote url using php code

in PHP Code / 1 Comment

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.

With more than 8 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 : php.anil@gmail.com

Discussion 1 Comment

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>