change print htmlContent => fwrite