i have an html email being generated by certain php functions and collected from several tables in the database and organized in an html layout..right now it is all in a preview.php page for testing the layout but when i need to send it to subscribers, i need to get the html code generated from this page only,and send that code in an email.and i mean by page source the one i see when i right click on the page and then click view source..so how do i get this page source ? or save it into a certain variable to use it ?
Share
Option 1:
Use file_get_contents(), since it returns the file in a string:
$html = file_get_contents('preview.php')Your whole html is now saved in the
$htmlvariable as a string.Option 2:
If your preview.php contains some PHP processing, you can do this instead (so that the PHP codes get executed, and you still get the resulting html):
Again, your whole html is now saved in the
$htmlvariable as a string.