Fetching javascript output using php
<p>For example i have this code in js.php</p>

<pre><code>&lt;script type="text/javascript"&gt;
document.write(Math.random());
&lt;/script&gt;
</code></pre>

<p>This gives output the random number, forexample: <code>0.123123123123</code></p>

<p>Now, I have fetch.php
I tried this code:</p>

<pre><code>&lt;?
 echo file_get_contents("js.php");
?&gt;
</code></pre>

<p>this gives output as:</p>

<pre><code>&lt;script type="text/javascript"&gt;
document.write(Math.random());
&lt;/script&gt;
</code></pre>

<p>But, I want output as <code>0.123123123123</code> -- which is the output generated by javascript. I don't want the source code, but the output of that code. How can I do this using PHP? </p>

<p>Note: Random number is just a sample. I have something else to work on.</p>
