Valid URL or not?
Posted in Help the coder! on Aug 22, 2009 at 09:04 IST (over 4 years ago). Subscribe to this post
Email
Showing comments 1 to 4 of total 4 on page 1 of 1
Post replyShowing comments 1 to 4 of total 4 on page 1 of 1
« Previous1Next »
rhitwickRank: 305
Hello friends,
How can i know whether the given string is a valid URL or not? That is, if i enter www.aaaaaaaaaaaaaabbbbb.com, my program should be able to identify that its not a real address, though it looks valid. And if i enter www.google.com, it should identify it as a real one.
I need to do this using PHP. Any idea?
How can i know whether the given string is a valid URL or not? That is, if i enter www.aaaaaaaaaaaaaabbbbb.com, my program should be able to identify that its not a real address, though it looks valid. And if i enter www.google.com, it should identify it as a real one.
I need to do this using PHP. Any idea?
Posted by rhitwick on Saturday, August 22, 2009, 9:04 am
calvinRank: 60
I've heard that regular expressions help one in validating string patterns. I dont know how it works though.
http://www.regular-expressions.info/php.html
Perhaps that could offer you some help!
http://www.regular-expressions.info/php.html
Perhaps that could offer you some help!
Posted by calvin on Saturday, August 22, 2009, 7:03 pm
robinalexRank: 1
Install http extension, refer following links for more information:
http://usphp.com/manual/en/book.http.php
http://pecl.php.net/package/pecl_http
Now, you can make an http request for the URL and see that page really exists.
Posted by robinalex on Sunday, August 23, 2009, 8:45 am
tsanand129Rank: 23
Hi
This should do the trick
if(checkdnsrr($hostname))
{
echo "valid";
}
else
{
echo "in valid";
}
This should do the trick
if(checkdnsrr($hostname))
{
echo "valid";
}
else
{
echo "in valid";
}
Thankful users: rhitwick
Posted by tsanand129 on Sunday, August 23, 2009, 11:01 pm
Pages: « Previous1Next »