Home » PHP Code »

1

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

<?php
$regex = '/]*>(.*<\/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;
 
?>
 
<!-- HTML Footer Data here... -->

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


Related Posts

    How to get the real IP address using php?How to get loaded modules in the server using php codeSearching for existing domain names?How to get the php data grid?

 

1 Comment

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

Leave a Reply