Home > PHP > PHP Code > Copy text from remote url using php code

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.

You may also like
Website uptime monitoring using PHP script
Understanding the basic need of MVC architecture
How to convert feeds to html using javascript and php
Multi-language support for web application with MySql and PHP

1 Response

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.