- preg_last_error: documentation ( source)
- preg_replace: documentation ( source)
<?php
$html = <<<EOD
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="content-type">
<meta content="text/html">
<title>Bertoni - tašky s příběhem</title>
<style type="text/css">
</style>
</head>
<body bgcolor="#edeeef" leftmargin="0" marginheigh="0" marginwidth="0" style="background-color:#edeeef" topmargin="0"><!--Pokud se vám zpráva nezobrazuje správně, klikněte zde.-->
<table align="center" bgcolor="#FFFFFF" width="100%">
<tbody>
<tr>
<td>
<!--logo MILVAI-->
<table align="center" cellpadding="0" cellspacing="0" width="600">
<tbody>
<tr>
<td align="center" height="100" width="600"><a href="http://milvai.cz/bertoni-tasky-s-pribehem.html?utm_source=newsletter&utm_medium=email&utm_campaign=1536-bertoni-tasky-s-pribehem"><img align="center" alt="Milvai - Týdení inspirace" src="http://cdn.deliverio.cz/milvai1536/images/logo.gif" style="display:block; border:0;" title="Milvai - Týdenní inspirace" /></a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<!--banner-->
<table align="center" cellpadding="0" cellspacing="0" width="600">
<tbody>
<tr>
<td align="center" height="212" width="600"><a href="http://milvai.cz/bertoni-tasky-s-pribehem.html?utm_source=newsletter&utm_medium=email&utm_campaign=1536-bertoni-tasky-s-pribehem"><img align="center" alt="Hlavní banner pro kampaň Bertoni - tašky s příběhem" src="http://cdn.deliverio.cz/milvai1536/images/banner.jpg" style="display:block; border:0;" title="Bertoni - tašky s příběhem" /></a>
</td>
</tr>
</tbody>
</table>
<!--Text-->
<!--space-->
<table align="center" cellpadding="0" cellspacing="0" height="6px" width="600">
<tbody>
<tr>
<td align="center" height="6px" width="600">
</td>
</tr>
</tbody>
</table>
<!--produkty 1 řada-->
<!--Ostatní kampaně--><!--socialni site-->
<table align="center" cellpadding="0" cellspacing="0" height="20" width="600">
<tbody>
<tr>
<td>
</td>
</tr>
</tbody>
</table>
<!--#-->
<table align="center" cellpadding="0" cellspacing="0" height="20" width="600">
<tbody>
<tr>
<td>
</td>
</tr>
</tbody>
</table>
<table align="center" cellpadding="0" cellspacing="0" width="600">
<tbody>
<tr>
<td align="center" width="600"><font style="font-family:Tahoma,Verdana,Arial; font-size:12px; color:#707070;" text-align="center">#milvaicz</font>
</td>
</tr>
</tbody>
</table>
<!--konec-->
<p>[CONSENT_FOOTER]
</p>
</body>
</html>
EOD;
echo preg_replace('/<body(.*?)>((?:.|\n)*)<\/body>/', '<body><div$1>$2</div><div class="footer">FOOTER</div></body>', $html);
echo "ERROR:" . preg_last_error();