1function urlExists($url=NULL)
2 {
3 if($url == NULL) return false;
4 $ch = curl_init($url);
5 curl_setopt($ch, CURLOPT_TIMEOUT, 5);
6 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
7 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
8 $data = curl_exec($ch);
9 $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
10 curl_close($ch);
11 if($httpcode>=200 && $httpcode<300){
12 return true;
13 } else {
14 return false;
15 }
16 }
17