[PHP] I want to know if some link is online

2005-10-09 Thread Jesús Alain Rodríguez Santos
I would like to know if a web is online, a have this code:

enlace.php

?
$vivo = verde.gif;
$muerto = rojo.gif;

$enlinea = fopen($enlace, r);
 if (!$enlinea){
header(Location: $muerto);
}
 else {
   header(Location: $vivo);
  }
fclose($enlinea);
?

In other page  I hve this:

page.php

img src=estado.php?enlace=http://www.cfg.jovenclub.cu;

Somebody can tell me what it's wrong, because the image did not
show, of course that the pages and bouth image are in the same
dorectory.
Please any suggestion


-- 
Este mensaje ha sido analizado por MailScanner
en busca de virus y otros contenidos peligrosos,
y se considera que está limpio.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] I want to know if some link is online

2005-10-09 Thread Jasper Bryant-Greene

Jesús Alain Rodríguez Santos wrote:

I would like to know if a web is online, a have this code:

enlace.php

?
$vivo = verde.gif;
$muerto = rojo.gif;

$enlinea = fopen($enlace, r);


Why not use file_exists()? Also, you probably want to use 
$_GET['enlance'] rather than $enlance.



 if (!$enlinea){
header(Location: $muerto);
}


You need to specify an absolute URI here 
(http://www.example.com/myimage.gif for example).


--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php