I am new to web development and remember from past that a friend of mine once had an implementation in which Server response stream of HTML was stored in a variable and then output as PDF, this was JSP some ages ago. I don't know how to achieve this in Yii rather bit skeptical if I even remember it right. I have explored TCPDF and can produce the PDF by coding the HTML tags, however, I am looking into the option to stream the output of a URL response in a variable and then use that to generate the PDF. I did the following but it is not working. I receive error at filesize($filename):
$filename = 'http://localhost/webapp/index.php/link/to/some/page';
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
I am bit lost on how to achieve this, all the help is much appreciated. Thanks in advance.