Results 1 to 16 of 16

Thread: identifying broken links...

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    India
    Posts
    298

    identifying broken links...

    Hi,
    Im looking at going thro' a site and identifying broken links. Any ideas on how this can be done?? Thanx a lot in advance

  2. #2
    scoutt
    Guest
    yeah get a program called "Xenu" a link verifier

  3. #3

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    India
    Posts
    298
    thanx scoutt and ricmitch_uk...will check them out......

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    India
    Posts
    298
    will these tools work from PHP pages? or will I have to use php functions to do my work for me?
    (the function fopen can be used to check if a URL is valid, right?)

    thanx again.

  6. #6
    scoutt
    Guest
    yeah but how are you going to tell if the site is up or not? I don't think you can do what you want with php. that is why I suggested that program. using fopen will not tell you if it is alive or dead or even the if the site is valid.

  7. #7
    Fanatic Member ubunreal69's Avatar
    Join Date
    Apr 2001
    Location
    Morayfield, Australia
    Posts
    609
    is there a way to do this for Email ?? (validate email) ?

  8. #8
    scoutt
    Guest
    all you can do is validate the syntax of the email. same goes with it. you can't send a message and get a response back.you would never know.

  9. #9
    Fanatic Member ubunreal69's Avatar
    Join Date
    Apr 2001
    Location
    Morayfield, Australia
    Posts
    609
    how can i validate the syntax then ? (thats what i meant before )

  10. #10
    scoutt
    Guest
    sure validate it like this. sorry I thought you meant the other way.

    PHP Code:
    $email "[email protected]"
    if (!preg_match('/^[-!#$%&\'*+\\.\/0-9=?A-Z^_`{|}~]+@([-0-9A-Z]+\.)+([0-9A-Z]){2,4}$/i'$email)) {
      echo(
    "<br><b>Your email doesn't seem to be valid. </b>");
    exit;
     } 

  11. #11
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    Here's a little function I wrote to verify as much as possible that an email address is valid. It checks syntax then it checks to make sure the domain of the address actually accepts email.

    It's as close as you can get without actually sending mail and asking the user to send it back
    PHP Code:
    function valid_email($address) {
        
    // check address is of valid format and that there is a mail server that will accept it
        
    if (ereg("^[a-zA-Z0-9_\.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$"$address)) {
            
    // valid format, check mail server
            
    $email_parts explode("@"$address);
            
    $email_host $email_parts[1];

            if (@
    getmxrr($email_host$mxhostsarr)) {
                
    // valid host
                
    return true;
            } else {
                
    // Domain doesn't exist or no mail server.
                
    return false;
            }
        } else {
            
    // not valid, no point checking mail server
            
    return false;
        }


  12. #12
    Fanatic Member ubunreal69's Avatar
    Join Date
    Apr 2001
    Location
    Morayfield, Australia
    Posts
    609
    hmmm, thanx ppl i needed that for my signup page.

  13. #13
    scoutt
    Guest
    Originally posted by chrisjk
    Here's a little function I wrote to verify as much as possible that an email address is valid. It checks syntax then it checks to make sure the domain of the address actually accepts email.

    It's as close as you can get without actually sending mail and asking the user to send it back
    PHP Code:
    function valid_email($address) {
        
    // check address is of valid format and that there is a mail server that will accept it
        
    if (ereg("^[a-zA-Z0-9_\.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$"$address)) {
            
    // valid format, check mail server
            
    $email_parts explode("@"$address);
            
    $email_host $email_parts[1];

            if (@
    getmxrr($email_host$mxhostsarr)) {
                
    // valid host
                
    return true;
            } else {
                
    // Domain doesn't exist or no mail server.
                
    return false;
            }
        } else {
            
    // not valid, no point checking mail server
            
    return false;
        }

    Chris, functions like that will go real good at my site. if you could add some of your famous recipes I would appreciate it.

  14. #14
    Fanatic Member ubunreal69's Avatar
    Join Date
    Apr 2001
    Location
    Morayfield, Australia
    Posts
    609
    lol, if i could just get a dollar for every time Scoutt asks someone to add stuff ....

  15. #15
    scoutt
    Guest
    me too. but how else am I going to get people to add stuff. I don't want to spam these wonderful forums.... I know, subliminal messages yeah that's it....

    <Subliminal message>
    add code on scoutts site, add code on scoutts site, add code on scoutts site, add code on scoutts site, add code on scoutts site, add code on scoutts site, add code on scoutts site, add code on scouts site
    </Subliminal message>

  16. #16
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    sure, i'll add a few when I get an opportunity

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width