我想使用来自使用报表查看器的页面的数据,并且我的CURL代码没有找到此查看器的数据。从报表查看器中使用PHP和CURL进行刮取
页属于这个网站:fiscalizandocomtce
<?php
$curl = curl_init("http://reportviewer.tce.mg.gov.br/default.aspx?server=noruega&relatorio=SICOM_Consulta%2f2017%2fModulo_AM%2fDetalhamentos%2fUC31-DetContratos-RL&contrato=8678102&periodoSelecionado=0&remessaSelecionada=662325639,668743165,674898703,675479698,682749064,682749296,682752194,684843149,687617053,689543045,689556683,689827842,690502542&orgaoSelecionado=11938&exercicioSelecionado=2017");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
$page = curl_exec($curl);
if(curl_errno($curl)) // check for execution errors
{
echo 'Scraper error: ' . curl_error($curl);
exit;
}
echo $page;
?>
我已经使用过simple_html_dom试过,但它也不能从问题的网页的报表浏览器捕获数据。
<?php
include('simple_html_dom.php');
$html = file_get_html('http://reportviewer.tce.mg.gov.br/default.aspx?server=noruega&relatorio=SICOM_Consulta%2f2017%2fModulo_AM%2fDetalhamentos%2fUC31-DetContratos-RL&contrato=8678102&periodoSelecionado=0&remessaSelecionada=662325639,668743165,674898703,675479698,682749064,682749296,682752194,684843149,687617053,689543045,689556683,689827842,690502542&orgaoSelecionado=11938&exercicioSelecionado=2017');
// extract text from HTML
echo $html->plaintext;
?>
除了我提到的两个之外,还有其他方法可以做到吗? 感谢您的帮助!
https://github.com/guzzle/guzzle – mkaatman