1

在有人说什么或“跳”之前,我想说我已经读过:

这是我的功能:

  function UolgetHtmlfromAjaxCallback($a_Params,$url) {

  $EVENTTARGET = $this->UolgetAtributoEventTarget($a_Params['s_EventTarget']);
  $s_smMaster = 'ctl00$cphSite$upModelo|'.$entries['target'];
  $VIEWSTATE = urlencode($a_Params['s_ViewState']);

  $options = array(
    CURLOPT_RETURNTRANSFER => true, // return web page
    CURLOPT_HEADER => false, // don't return headers
    CURLOPT_FOLLOWLOCATION => true, // follow redirects
    CURLOPT_ENCODING => "", // handle all encodings
    CURLOPT_USERAGENT => "spider", // who am i
    CURLOPT_AUTOREFERER => true, // set referer on redirect
    CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect
    CURLOPT_TIMEOUT => 120, // timeout on response
    CURLOPT_MAXREDIRS => 10, // stop after 10 redirects
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => 'ct100%24smMaster='.urldecode($s_smMaster).
                          '&__EVENTTARGET='.urlencode($EVENTTARGET['target']).
                          '&__EVENTARGUMENT='.urlencode('').
                          '&__EVENTVALIDATION='.urlencode($s_Eventvalidation).
                          '&__VIEWSTATE='.$VIEWSTATE.
                          '&ct100%24txtBuscaNome='.$a_Params['ctl00_txtBuscaNome'].
                          '&__ASYNCPOST=true'
                          );

  $ch = curl_init( $url );
  curl_setopt_array( $ch, $options );
  $result = curl_exec ($ch);

  return $result;
  }

$VIEWSTATE没关系,并且$EVENTTARGET是具有这些值的数组:

Array ( 
 [id] =>          ctl00_cphSite_fichaTecnicaEditorial_rptCarrosFichaTecnica_ctl00_lbtnFichaTecnica 
 [target] => ctl00$cphSite$fichaTecnicaEditorial$rptCarrosFichaTecnica$ctl00$lbtnFichaTecnica ) 

我正在尝试使用此代码来抓取此网站:

http://comparecar.uol.com.br/Modelo/Volvo-Xc60

我得到了网站,但没有得到汽车的信息。

我编辑自己的信息。

我正在使用 Tamper Data,发现帖子使用了不同的参数:

  • ctl00%24smMaster
  • __EVENTTARGET
  • __EVENTARGUMENT
  • __VIEWSTATE
  • __EVENTVALIDATION
  • ctl00%24txtBuscaNome
  • __ASYNCPOST

并以“=”结束

4

0 回答 0