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
Printable View
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
yeah get a program called "Xenu" a link verifier
thanx scoutt and ricmitch_uk...will check them out......
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.
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.
is there a way to do this for Email ?? (validate email) ?
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.
how can i validate the syntax then ? (thats what i meant before ;))
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;
}
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;
}
}
hmmm, thanx ppl :) i needed that for my signup page.
Chris, functions like that will go real good at my site. if you could add some of your famous recipes :) I would appreciate it.Quote:
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;
}
}
lol, if i could just get a dollar for every time Scoutt asks someone to add stuff .... :D
:D 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>
sure, i'll add a few when I get an opportunity ;)