Ver Mensaje Individual
  #3 (permalink)  
Antiguo 26/10/2011, 09:10
meg76
 
Fecha de Ingreso: abril-2009
Mensajes: 30
Antigüedad: 15 años
Puntos: 0
Respuesta: Incorporar información remota dinamica

mcun:

Tienes razon, no me he explicado bien. La variable request es la que contiene todas las variables que envia la sesion del ordenador remoto y que se cargan como: index.php?var1=1&var2=2 etc.

Pongo código que uso para hacerme entendedor:
Fuente (http://php.net/manual/es/language.variables.external.php)

<?php
// -----------------------------------------------------------------
// Basic Data PHP module. This module captures all GET, POST
// and COOKIE data and processes it into variables.
// Coded April, 2005 by Timothy J. Pauly
// -----------------------------------------------------------------
//
// coo_ is prepended to each cookie variable
// get_ is prepended to each GET variable
// pos_ is prepended to each POST variable
// ses_ is prepended to each SESSION variable
// ser_ is prepended to each SERVER variable

session_start(); // initialize session data
$ArrayList = array("_POST", "_GET", "_SESSION", "_COOKIE", "_SERVER"); // create an array of the autoglobal arrays
// we want to process

foreach($ArrayList as $gblArray) // process each array in the array list
{
$prefx = strtolower(substr($gblArray,1,3))."_"; // derive the prepend string
// from the autoglobal type name
$tmpArray = $$gblArray;
$keys = array_keys($tmpArray); // extract the keys from the array being processed
foreach($keys as $key) // process each key
{

$arcnt = count($tmpArray[$key]);

if ($arcnt > 1) // Break down passed arrays and
// process each element seperately
{
$lcount = 0;
foreach ($tmpArray[$key] as $dval)
{
$prkey = $prefx.$key; // create a new key string
// with the prepend string added
$prdata['$prkey'] = $dval; // this step could be eliminated
${$prkey}[$lcount] = $prdata['$prkey']; //create new key and insert the data
$lcount++;
}

} else { // process passed single variables

$prkey = $prefx.$key; // create a new key string
// with the prepend string added
$prdata['$prkey'] = $tmpArray[$key]; // insert the data from
// the old array into the new one
$$prkey = $prdata['$prkey']; // create the newly named
// (prepended) key pair using variable variables


}
}
}

// -------------------------------------------------------------
?>

Entonces la instrucción que sigue es la te he sugerido: (he cambiado el $_request por el $prkey)

$page = file_get_contents('http://www.cominio.com/index.php?$prkey');
echo $page;

La cuestión es que en el navegador veo que efectivamente se cargan las variables cualdo selecciono una opción del menu del contenido remoto, pero ello no se materializa en lo que veo en la página, que siempre muestra la página principal.

Si actualizo la página me devolverá siempre la página principal. Debería actualizar solo el file_get_contents cada vez que se seleccionara una opción en el ordenador remoto. Es eso posible?

No se si es el mejor camino o lo que quiero hacer es imposible. Alguna ayuda?