Ver Mensaje Individual
  #4 (permalink)  
Antiguo 11/07/2008, 06:47
Suyta
(Desactivado)
 
Fecha de Ingreso: septiembre-2004
Mensajes: 360
Antigüedad: 19 años, 7 meses
Puntos: 1
Respuesta: CURL tomar y enviar una cookie

Intento tomar la cookie correcta y re-enviarla con esto:

Código PHP:
$url 'http://visionweb.occourts.org/Vision_Public/SearchCase.do#searchResults';
$c get_headers($url);
$d explode(":",$c[3]);
$cotrim($d[1]);
$co2=explode("=",$co);
$co3=explode(';',trim($co2[1]));
$urls'http://visionweb.occourts.org/Vision_Public/SearchCase.do;jsessionid='.trim($co3[0]);
//<form name="caseInfoDisplayForm" method="post" action="/Vision_Public/DisplayCaseInfo.do">
$casenumber="06SM02800";
$fields = array(
                        
'caseNbr'=>$casenumber,
                        
'lastName'=>"",
                         
'advSearch' =>"",
                         
'middleName'=>"",
                         
'enterpriseName'=>"",
                         
'dln'=>"",
                         
'firstName'=>"",
                         
'dob_month'=>"",
                         
'dob_day'=>"",
                         
'dob_year'=>"",
                         
'strictErrorChecking'=>"true",
                         
'action'=>"1"
                
);
foreach(
$fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
rtrim($fields_string,'&');

function 
readHeader($ch$header){
    echo 
$header;
}

$ch curl_init();
$header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,";
  
$header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
  
$header[] = "Cache-Control: max-age=0";
  
$header[] = "Connection: keep-alive";
  
$header[] = "Keep-Alive: 300";
  
$header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
  
$header[] = "Accept-Language: en-us,en;q=0.5";
  
$header[] = "Pragma: ";

curl_setopt($ch,CURLOPT_URL,$urls);
curl_setopt($chCURLOPT_USERAGENT$_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string);
curl_setopt($chCURLOPT_COOKIE$co);
curl_setopt($chCURLOPT_RETURNTRANSFER,1);
curl_setopt($chCURLOPT_REFERER'http://visionweb.occourts.org/Vision_Public/SearchCase.do');
                
$result curl_exec($ch);
curl_close($ch);

echo 
$result
Pero no funciona.
Qué estoy haciendo mal ?