Hola tengo una variable en php que contiene esto
Código HTML:
<p><span style="color: rgb(128, 128, 0);">This</span> is <span style="color: rgb(255, 204, 153);">some</span> <strong>sample text</strong>. You <span style="color: rgb(204, 255, 204);">are</span></p>
cuando pongo:
Código PHP:
echo $variable;
se me imprime en pantalla lo antes escrito, hasta ahora todo bien.
Mi pregunta surge cuando quiero crear un html y quiero poner el valor de esa variable, lo hago tal que asi:
Código PHP:
$xml.="<html><head><title></title></head>";
$xml.="<body>".$variable."</body></html>";
$sfile="productos.html";
$fp=fopen($sfile,"w+");
fwrite($fp,$xml);
chmod("$sfile", 0777);
fclose($fp);
El programa en vez de escribirme este código:
Código HTML:
<html><head><title></title></head>
<body>
<p><span style="color: rgb(128, 128, 0);">This</span> is <span style="color: rgb(255, 204, 153);">some</span> <strong>sample text</strong>. You <span style="color: rgb(204, 255, 204);">are</span></p>
</body></html>
Me escribe esto, una serie de caracteres raros que sustituyen a los otros ....
Código HTML:
<html><head><title></title></head>
<body>
<p><span style="color: rgb(128, 128, 0);">This</span> is <span style="color: rgb(255, 204, 153);">some</span> <strong>sample text</strong>. You <span style="color: rgb(204, 255, 204);">are</span> using <a href="http://www.fckeditor.net/">FCKeditor</a>.</p>
</body></html>
¿Como puedo conseguir que me lo escriba de la anterior forma?
Muchisimas gracias por adelantado.