Ver Mensaje Individual
  #6 (permalink)  
Antiguo 25/10/2010, 10:35
Grox
 
Fecha de Ingreso: mayo-2008
Mensajes: 82
Antigüedad: 16 años
Puntos: 3
Respuesta: file_get_contents con cookie

Cita:
Iniciado por abimaelrc Ver Mensaje
Lo que hice y me funcionó. Cree un archivo llamado
a.php
Código PHP:
Ver original
  1. <?php
  2. var_dump($_COOKIE);
b.php
Código PHP:
Ver original
  1. <?php
  2. $options = array('http' =>
  3.     array(
  4.         'header'  => 'Content-type: text/plain;charset=UTF-8' . PHP_EOL .
  5.         'Cookie: user=FDW; actividad=programacion;' . PHP_EOL
  6.     )
  7. );
  8. $context = stream_context_create($options);
  9. $page = file_get_contents('http://localhost/a.php', false, $context);
  10. echo $page;


Si, me funciona, pero necesitaba usar method post, para que logueara ya que no me aceptaba la cookie, y lo hice con cURL...

gracias de todas formas!!