Ver Mensaje Individual
  #4 (permalink)  
Antiguo 21/01/2011, 19:32
Avatar de cadrogui
cadrogui
 
Fecha de Ingreso: junio-2003
Mensajes: 875
Antigüedad: 23 años, 3 meses
Puntos: 5
Respuesta: cURL y cookies

aqui el code de php

Código PHP:
$headers = array(                        
                
"Host:                laweb",
                
"User-Agent:        Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; es-ES; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13",
                
"Accept:            */*",
                
"Accept-Language:    es-es,es;q=0.8,en-us;q=0.5,en;q=0.3",
                
"Accept-Encoding:    gzip,deflate",
                
"Accept-Charset:    ISO-8859-1,utf-8;q=0.7,*;q=0.7",
                
"Keep-Alive:        115",
                
"Connection:        keep-alive",
                
"Referer:            elform",
                
"Cookie:            consultando=si; JSESSIONID=0000cgL9PJNznaRpGCHehj3Z_HW:-1"
                
);

                        
                        
                        
$ch = curl_init();
                        
curl_setopt($ch, CURLOPT_REFERER,'http://laweb');
                        
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
                        
                        
curl_setopt($ch, CURLOPT_HEADER, 1);  
                        
curl_setopt($ch, CURLOPT_COOKIE, "consultando=si ; JSESSIONID=0000cgL9PJNznaRpGCHehj3Z_HW:-1");  
                        
                        
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);  
                        
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie_penal.txt'); 
                        
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie_penal.txt');                        
                        
                        
                        
curl_setopt($ch, CURLOPT_URL, $muestra_data['url_pjud'] );
                        
curl_setopt($ch, CURLOPT_POST, TRUE);
                        
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_str);
                        
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
                        
                        
$llamada_pjud = curl_exec($ch );
                        
$bytes_pjud = strlen($llamada_pjud); 
__________________
La mejor manera de aprender es por medio de un aprendizaje significativo....

http://www.cocert.cl