Re: Condition for link not found
| From: | Joey Smith | Date: | Thu, 20 Jun 2002 23:08:18 +0000 |
| Subject: | Re: Condition for link not found | ||
| References: | 1 2 3 | Groups: | php.lang |
| Request: | Send a blank email to php-lang+get-316@lists.php.net to get a copy of this message | ||
It depends on your needs. fread() or fgets() are probably the easiest way
to do it.
http://www.php.net/fread
http://www.php.net/fgets
On Wed, Jun 19, 2002 at 05:27:54PM -0400, JM wrote:
> Joey, great, the checking works! But how do I actually have the url open in
> the current window? What do I replace the line 'print"The url exists!"'
> with?
>
> $fp = @fopen("http://www.ibm.com","r");
> if ($fp)
> print"The url exists!";
> else
> print"The url does not exist";
>
>
> "Joey Smith" <joey@joeysmith.com> wrote in message
> news:20020619191836.GA18961@joeysmith.com...
> > http://www.php.net/fopen
> >
> > $f = fopen("http://www.ibm.com", "r")
> > or ...;
> >
> >
> > On Wed, Jun 19, 2002 at 02:28:15PM -0400, JM wrote:
> > > I'm a beginner at PHP but couldn't find this in the documentation.
> > >
> > > Can I construct a php condition that can check if a url exists?
> > >
> > > Something like this:
> > >
> > > if www.ibm.com is found
> > > then href=www.ibm.com
> > > else href=www.mysite.com/notfound.html
> > >
> > >
> > >
> > >
> > >
> > > --
> > > PHP Language Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
> --
> PHP Language Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php