title: Check if url is exist or not
body: <p>I've website where visitor would submit links so i would like of the posted url is exist or not so i've been using the following function</p>
  
  <pre><code>&lt;?PHP
          function url_exist($url){
          $c=curl_init();
          curl_setopt($c,CURLOPT_URL,$url);
          curl_setopt($c,CURLOPT_HEADER,1);
          curl_setopt($c,CURLOPT_NOBODY,1);
          curl_setopt($c,CURLOPT_RETURNTRANSFER,1);
          curl_setopt($c,CURLOPT_FRESH_CONNECT,1);
          if(!curl_exec($c)){
          return false;
          }else{
          return true;
          }}
  
      $ur = "http://www.google.com"; // example
  
      if(url_exist($url)){
      echo "yea valid";
      }else{
      echo "not valid";
      }
  ?&gt;
  </code></pre>
  
  <p>but my website become so slow and something not even loading at the step of checking if valid or not valid url so i wonder if there any idea else can do the same without loading too much on my hosting server as the above function !! ~ any help</p>