Foros del Web » Programando para Internet » PHP »

Problema al enviar parámetros de ASP a PHP

Estas en el tema de Problema al enviar parámetros de ASP a PHP en el foro de PHP en Foros del Web. PROBLEMA Hola a todos tengo un problema que debe ser muy fácil de solucionar pero en realidad me tiene loco…Estoy bajando forzadamente un archivo pdf ...
  #1 (permalink)  
Antiguo 02/04/2008, 14:02
 
Fecha de Ingreso: abril-2008
Mensajes: 8
Antigüedad: 16 años
Puntos: 0
Problema al enviar parámetros de ASP a PHP

PROBLEMA

Hola a todos tengo un problema que debe ser muy fácil de solucionar pero en realidad me tiene loco…Estoy bajando forzadamente un archivo pdf desde mi web con una página asp que envía por parámetro lo siguiente… (Este es el link para bajar el archivo pdf que esta en asp)

<a href="bajando.php?AuxPath=<%=TmpPath%>&Id=<%=TmpId %>">Bajar Archivo</a>

la página que debe recibir el parámetro esta en PHP es así

<?php

$enlace = $AuxPath.$Id;
header ("Content-Disposition: attachment; filename=".$Id."\n\n");
header ("Content-Type: application/octet-stream");
header ("Content-Length: ".filesize($enlace));
readfile($enlace);
?>
Esto me arroja un error ya que los parámetros no se traspasan a las variables…

Probé lo siguiente…para capturar los parámetros y saber si estaban llegando

$AuxPath = "<script language='javascript' type='text/javascript'>document.write(location.search.substri ng(9,146));</script>";
$Id = "<script language='javascript' type='text/javascript'>document.write(location.search.substri ng(150,location.search.length));</script>";

$enlace = $AuxPath.$Id;
echo $enlace;

Y COMO RESULTADO EN $enlase LOS PARAMETROS LLEGAN BIEN… PERO, AL AGREGAR AL CODIGO ESTO…

header ("Content-Disposition: attachment; filename=".$Id."\n\n");
header ("Content-Type: application/octet-stream");
header ("Content-Length: ".filesize($enlace));
readfile($enlace);

YA NO FUNCIONA

ME MUESTRA (EN EL PANEL PARA BAJAR) COMO NOMBRE DE ARCHIVO LO SIGUIENTE

<script language='javascript' type='text/javascript'>document.write(location.search.substri ng(9,146));</script>

Y CREO ME DEBERIA MOSTRAR EL CONTENIDO DEL LA VARIABLE $Id OSEA archivo.pdf

Alguien me podría decir que estoy haciendo mal o si lo mismo se puede hacer solo en asp…

Da ante mano gracias…


  #2 (permalink)  
Antiguo 02/04/2008, 15:32
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 11 meses
Puntos: 2135
Re: Problema al enviar parámetros de ASP a PHP

Prueba así:
Código PHP:
<?php
$Id 
$_GET['Id'];
$AuxPath $_GET['AuxPath'];

$enlace $AuxPath.$Id;
header ("Content-Disposition: attachment; filename=".$Id."\n\n");
header ("Content-Type: application/octet-stream");
header ("Content-Length: ".filesize($enlace));
readfile($enlace);
?>
Saludos.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 16:22.