title: pull content from an external website generated by javascript
body: <p>I know how to pull html content from an external website with php and parse it, but the problem is that the content I want to extract is generated by a javascript function.</p>
  
  <p>The code looks like this:</p>
  
  <pre><code>  &lt;div align="left"&gt;
     &lt;div id="divCotizaciones"&gt;&lt;/div&gt;
     &lt;script type="text/javascript"&gt;
             getCotizaciones("cotizaciones_busca.dat");
     &lt;/script&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>I would like to extract all the content generated by that function.
  This is the webpage from where I'm trying to pull the content: <a href="http://www.bvl.com.pe/neg_rv_alfa.html#" rel="nofollow">http://www.bvl.com.pe/neg_rv_alfa.html#</a></p>
  
  <p>I tried this, but it's not working:</p>
  
  <pre><code>$html = new DOMDocument();
  $html-&gt;loadHtmlFile('http://www.bvl.com.pe/neg_rv_alfa.html#');
  $xpath = new DOMXPath($html);
  $nodelist = $xpath-&gt;query('//*[@id="div"]/div[4]');
  echo $output = $nodelist-&gt;item(0)-&gt;nodeValue;
  
  // and this is the output I get: getCotizaciones("cotizaciones_busca.dat");
  </code></pre>