check real url

Check given link is real working

We see the most online enquiry ,guest books,help ticket system asks for the web address of the guest ,mostly of them are optional.i think in some case it required to given web address or page link really exists or not.Here we learn how to find the given link or url is really exists or it fake.For this we use simple fsocketopen function. we make a simple function that given below.It only check HTTP links.not HTTPS,FTP protocal urls. Remember the link parameter must be a valid web url address.we can do it with CURL php extension functions.but in case if it not available it won’t work. so given function is core PHP function.

1
2
3
4
5
<?php 
function isRealLink($link){
 return (boolean)@fsockopen($link, 80, $errno, $errstr, 30);
}
?>

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">