title: How can I parse html that includes javascript code
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2142271/server-side-browser-that-can-execute-javascript">Server side browser that can execute JavaScript</a><br>
    <a href="https://stackoverflow.com/questions/2699180/execute-javascript-in-php">Execute javascript in PHP</a>  </p>
  </blockquote>
  
  
  
  <p>How can I parse HTML that includes JavaScript code, preferably with PHP script if possible.</p>
  
  <p>As an example:</p>
  
  <pre><code>&lt;a href="javascript:link(10, true);"&gt;link&lt;/a&gt;
  </code></pre>
  
  <p>should be replaced by the appropriate value the JavaScript function returns, e.g.</p>
  
  <pre><code>&lt;a href="http://www.example.com"&gt;link&lt;/a&gt;
  </code></pre>
  
  <p>A more complex example would be a saved facebook html page which is littered with loads of javascript code.</p>
  
  <p>Summarized:
  Return a DOM for a page with html+javascript</p>