alguien me puede decir porque fopen me falla?
| From: | josu udaondo | Date: | Thu, 16 Oct 2008 08:56:16 +0000 |
| Subject: | alguien me puede decir porque fopen me falla? | ||
| Groups: | php.general.es | ||
| Request: | Send a blank email to general-es+get-63292@lists.php.net to get a copy of this message | ||
El código es el siguiente:
function geoip_open($filename, $flags)
{
$gi = new GeoIP;
$gi->flags = $flags;
if ($gi->flags & GEOIP_SHARED_MEMORY) {
$gi->shmid = @shmop_open (GEOIP_SHM_KEY, "a", 0, 0);
} else {
echo 'el archivo es:'.$filename.'<br>';
if (archivo_existe($filename)) echo ' el archivo
'.$filename.' existe.<br>'; else echo ' el archivo '.$filename.'
no
existe<br>';
$gi->filehandle = fopen($filename,"rb");
// FALLA AQUI!!!
if ($gi->flags & GEOIP_MEMORY_CACHE) {
$s_array = fstat($gi->filehandle);
$gi->memory_buffer = fread($gi->filehandle, $s_array['size']);
}
}
$gi = _setup_segments($gi);
return $gi;
}
function archivo_existe($archivo)
{
$retorno = false;
echo $archivo.'<br>';
if (url_exists('http://'.$archivo))
{
$retorno = true;
}
else
{
echo 'urlexists dice que no existe '.$archivo.<br>;
if(file_exists($archivo))
{
$retorno = true;
}
}
return $retorno;
}
function url_exists($url)
{
$hdrs = @get_headers($url);
return is_array($hdrs) ?
preg_match('/^HTTP\\/\\d+\\.\\d+\\s+2\\d\\d\\s+.*$/',$hdrs[0]) : false;
}
En pantalla el echo escribe:
el archivo es:http://localhost/epiezas/v1/include/GeoIP.dat
Warning: fopen(http://localhost/epiezas/v1/include/GeoIP.dat)
[function.fopen <http://localhost/epiezas/v1/site/function.fopen>
]: failed
to open stream: Se produjo un error durante el intento de conexión ya que la
parte conectada no respondió adecuadamente tras un periodo de tiempo, o bien
se produjo un error en la conexión establecida ya que el host conectado no
ha podido responder. in D:\xampp\htdocs\epiezas\v1\include\geoip.inc on line
318
Fdo Josu Udaondo Orúe