我想使用來自使用報表查看器的頁面的數據,並且我的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