Jump to content


Check if a website exists and if so, create a link

  • Please log in to reply
1 reply to this topic

#1 jamesvasey

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 09 June 2006 - 05:57 PM

I want to provide a link to a users public_html directory from our companies intranet, but only if it exists for the user. (as not all users have a public_html, and i dont want them to end up in error404)

i.e. user: bob (logged in using http_auth) PHP checks to see if [a href=\"http://servername/~bob\" target=\"_blank\"]http://servername/~bob[/a] exists, if it does then show a link, if it doesnt (Error 404) then don't show the link.

The public_html's are on a different server, so I cant look at the local hard disk.

Any ideas? I am guessing some form of wget, followed by an if statement (depending on an error 404).


#2 poirot

  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 09 June 2006 - 06:02 PM

You can check that using fopen:

[a href=\"http://www.php.net/fopen\" target=\"_blank\"]http://www.php.net/fopen[/a]
~ D Kuang

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users