In my PHP file, I have a string variable that contains complete HTML code.
$content = '<html>
In loop, I've created the URL to hit the controller and set the parameters with it and then simple use the following statement.
and In the $url variable, I created the URL and post data in it. That's how, the new tab will open that hits the url and result will be my complete HTML.