I'm making a guestbook, and one of the fields they can add, is their homepage.
I have some simple tests, like checking for an @ and a . in the email and stuff like that. Security isn't very important. But is there a way to check if the adress they entered exists? like for instance, if I put <!-- w --><a class="postlink" href="http://www.google.com">www.google.com</a><!-- w --> in the homepage field in the form.
How can I with PHP check if <!-- w --><a class="postlink" href="http://www.google.com">www.google.com</a><!-- w --> really exists?<?php
$url = "www.google.com";
$check = fsockopen($url, 80);
if(!$check)
{
echo "$url doesn't exist";
}
?>hm....didn't work very well, could be I who are using it wrong, but isnt important. Thanks anyway =)make sure the url has an http:// in the front.
I have some simple tests, like checking for an @ and a . in the email and stuff like that. Security isn't very important. But is there a way to check if the adress they entered exists? like for instance, if I put <!-- w --><a class="postlink" href="http://www.google.com">www.google.com</a><!-- w --> in the homepage field in the form.
How can I with PHP check if <!-- w --><a class="postlink" href="http://www.google.com">www.google.com</a><!-- w --> really exists?<?php
$url = "www.google.com";
$check = fsockopen($url, 80);
if(!$check)
{
echo "$url doesn't exist";
}
?>hm....didn't work very well, could be I who are using it wrong, but isnt important. Thanks anyway =)make sure the url has an http:// in the front.