Ver Mensaje Individual
  #8 (permalink)  
Antiguo 06/09/2011, 15:28
Coffin
 
Fecha de Ingreso: septiembre-2011
Mensajes: 7
Antigüedad: 12 años, 7 meses
Puntos: 0
Respuesta: Obtener url remota

no obtube la url remota pero lo que hice fue esto:

por si a alguien le interesa...

Código PHP:
Ver original
  1. <?php
  2.  
  3. //obtenemos el dominio de donde se hace la peticion
  4. $host=$_SERVER['HTTP_HOST'];
  5.  
  6. //Iniciamos cURL.
  7. $ch = curl_init();
  8.  
  9. //Accedemos a la URL
  10. curl_setopt($ch, CURLOPT_URL, "url-del-host-A");
  11.  
  12. //Indicamos que vamos a enviar datos por Post.
  13. curl_setopt ($ch, CURLOPT_POST, true);
  14.  
  15. //Iniciamos una sesion
  16. curl_setopt($ch, CURLOPT_COOKIE, 'PHPSESSID=cookie;');
  17.  
  18. //Indicamos que queremos imprimir el resultado
  19. curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
  20.  
  21. //Hacemos uso de un User Agent
  22. curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; es-ES; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13");
  23.  
  24. //Enviamos los datos por post
  25. curl_setopt ($ch, CURLOPT_POSTFIELDS, "varibable-a-enviar=".urlencode($host));
  26.  
  27. //Ejecutamos e imprimimos el resultado
  28. echo curl_exec($ch);
  29.  
  30. ?>

Código PHP:
Ver original
  1. <?php
  2.  
  3. //y en el host a obtenemos la variable asi
  4.  
  5. host = $_POST["variable-a-enviar"];
  6.  
  7.  
  8. ?>

salute :) y despues lo Cifre