My script writes content of < textarea > to text file:
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head> etc
Is there anyway I can convert output to clean html so it looks like this:
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
etc :)
$file = 'wp.txt';
$regex = '/<textarea name="example" id="newcontent">(.*?)<\/textarea>/s';
if ( preg_match($regex, $page, $list) )
echo $list[0];
else
print "Error";
$file = 'wp.txt';
file_put_contents($file, $list, FILE_APPEND | LOCK_EX);
Thanks!