phpを使用して外部Webサイトからhtmlコンテンツをプルして解析する方法を知っていますが、問題は、抽出したいコンテンツがjavascript関数によって生成されることです。
コードは次のようになります。
<div align="left">
<div id="divCotizaciones"></div>
<script type="text/javascript">
getCotizaciones("cotizaciones_busca.dat");
</script>
</div>
その関数によって生成されたすべてのコンテンツを抽出したいと思います。これは、私がコンテンツをプルしようとしているWebページです:http ://www.bvl.com.pe/neg_rv_alfa.html#
私はこれを試しましたが、機能していません:
$html = new DOMDocument();
$html->loadHtmlFile('http://www.bvl.com.pe/neg_rv_alfa.html#');
$xpath = new DOMXPath($html);
$nodelist = $xpath->query('//*[@id="div"]/div[4]');
echo $output = $nodelist->item(0)->nodeValue;
// and this is the output I get: getCotizaciones("cotizaciones_busca.dat");