Y va cargandose con llamadas de ajax de .net. Hasta aquí todo bien.
Usando Tamper Data he llegado a sacar los parametros que pasa en la llamada de ajax. así como todos los parametros de header.
Código PHP:
function UolgetHtmlfromAjaxCallback($s_EventTarget,$a_Params,$url) {
if(!($_COOKIE['.ASPXANONYMOUS'])) {
$a_PeticionAnonimo = get_headers($url);
$_COOKIE['.ASPXANONYMOUS'] = $this->LimpiarValoresCookies($a_PeticionAnonimo, 3);
}
if(!($_COOKIE['ASP.NET_SessionId'])) {
$a_PeticionId = get_headers($url);
$_COOKIE['.ASPXANONYMOUS'] = $this->LimpiarValoresCookies($a_PeticionId, 4);
}
$EVENTTARGET = $this->UolgetAtributoEventTarget($s_EventTarget);
$values['ctl00$smMaster'] = 'ctl00$cphSite$upModelo|'.$EVENTTARGET['target'];
$values['__EVENTTARGET'] = $EVENTTARGET['target'];
$values['__EVENTARGUMENT'] = '';
$values['__VIEWSTATE'] = $a_Params['ViewState'];
$values['ctl00$txtBuscaNome'] = $a_Params['BuscaNome'];
$values['__ASYCPOST'] = 'true';
$Encode_values = http_build_query($values);
$agent = array( "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.0.9) Gecko/20061206 Firefox/1.5.0.9",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; StumbleUpon.com 1.760; .NET CLR 1.1.4322)",
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:x.x.x) Gecko/20041107 Firefox/x.x",
"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 Epiphany/1.2.1",
"Opera/9.00 (Windows NT 5.1; U; de)","Mozilla/5.0 (compatible; Konqueror/2.2.2; Linux 2.4.14-xfs; X11; i686)",
"Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.0.1),Gecko/20021219 Chimera/0.6",
"Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US) AppleWebKit/xx (KHTML like Gecko) OmniWeb/v5xx.xx",
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; bgft)"); // Random UA para Tor
$http_headers = array("Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5",
"Accept-Language: en-gb,en;q=0.5",
"Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7",
"Keep-Alive: 300",
"Connection: keep-alive");
$encoding = "gzip,deflate";
$options = array(
CURLOPT_RETURNTRANSFER => true, // return web page
CURLOPT_HTTPHEADER => $http_headers,
CURLOPT_HEADER => false, // don't return headers
CURLOPT_FOLLOWLOCATION => true, // follow redirects
CURLOPT_ENCODING, $encoding, // handle all encodings
CURLOPT_USERAGENT => $agent[rand(0,9)], // 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 => $Encode_values,
CURLOPT_COOKIEFILE, $cookie,
CURLOPT_COOKIEJAR, $cookie
);
$ch = curl_init( $url );
curl_setopt_array( $ch, $options );
$result = curl_exec ($ch);
return $result;
}
La verdad es que es mi primera vez en serio con curl y puede que la este metiendo hasta el fondo.
Se agradecen sugerencias.
Oskar