Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/05/2011, 11:45
murcielag56
 
Fecha de Ingreso: septiembre-2010
Mensajes: 72
Antigüedad: 13 años, 7 meses
Puntos: 0
error en file_get_contents

Tengo un formualrio donde le indico que escriba la pagina web. Éste debe ir a calcular velocidad y otros dados en un PHP, pero me da un error:
Warning: file_get_contents($direccion) [function.file-get-contents]: failed to open stream: No such file or directory in C:\xampp\htdocs\Integra2_1\veloc_descarga.php on line 15

Lo que tengo es:
FORMULario
<html>
<head><title> velocidad </title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body {
background-color: #669900;
}
.Estilo1 {
color: #CC0033;
font-weight: bold;
}
-->
</style></head>
<body>
<center><h1><strong> </strong></h1>
<h2>MENU VELOCIDAD DESCARGA WEBS </h2>
<p>&nbsp;</p>
<table width="84%" border="2" cellspacing="1" cellpadding="5">
<tr>
<td width="36%" height="57"><div align="center">INTRODUCCION NOMBRE P&Aacute;GINA </div></td>
<td width="64%"><form name="form1" method="post" action="veloc_descarga.php">
<p>Nombre de la p&aacute;gina WEB
<input type="text" name="url" >
escriba asi http://www.google.com
</p>
<p>
<input type="submit" name="Submit" value="Enviar">
</p>
<p>&nbsp; </p>
</form></td>
</tr>
<tr>
<td height="64">ESTADISTICAS</td>
<td>&nbsp;</td>
</tr>
</table>
<h1 class="Estilo1">&nbsp;</h1>
<p class="Estilo1">&nbsp;</p>
<p class="Estilo1">&nbsp;</p>
<p class="Estilo1">&nbsp;</p>
<hr>

<p> <br>

<p>&nbsp;</p>
</form>
</center>
</body>
</html>

script

$direccion=$_REQUEST['url'];

if($direccion){
echo "$direccion";
//Veloc (bits / segundo) = bits / (TFin - TComienzo)
//carácter CUALQUIERA siempre tendrá un tamaño de 1 Byte, es decir 8 impulsos electrónicos ( 8 Bit)
$tmicro[1]= microtime();
$q_espacios = explode(" ",$tmicro[1]);
$tiempo_[1]= $q_espacios[1]+$q_espacios[0];

//file_get_contents — Transmite un archivo entero a una cadena
$pagina=file_get_contents('$direccion');
$tamanoKB= strlen($pagina)/1024;
//for ($i=0;$i<$tamanoKB;$i++){
//for ($i=0;$i<srtlen($pagina);$i++){
//$line = fget($pagina);
//}
//$tamanoKB= strlen($pagina)/1024;

echo $tamanoKB ."<br>";

$tiempo_micro[2] = microtime();
$q_espacios= explode(" ",$t_micro[2]);
$tiempo_[2] =$q_espacios[1] + $q_espacios[0];
$timeutilizado = number_format(($tiempo_[2] - $tiempo_[1]),2, "." ,","); //Format a number with grouped thousands

$velocdescarga= round($tamanoKB/$timeutilizado,3);

echo 'velocidad de conexión es de: '.$velocdescarga.' Kbps <br /> Se enviarón:'.$tamanoKB.
' Kb, Tiempo utilizado: '.$timeutilizado.' Segundos <hr>';
}
?>