title: cURL not working sometimes and gives empty result
body: <p>I used cURL to get data from another website. Sometimes it shows data and sometimes empty result</p>
  
  <p>Here is my Code</p>
  
  <pre>
  
      function get_data($url) {
          $ch = curl_init();
          curl_setopt($ch, CURLOPT_URL, $url);
          $agent=$_SERVER["HTTP_USER_AGENT"];
          curl_setopt($ch,CURLOPT_USERAGENT, $agent); 
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
           curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false);
  
          $data = curl_exec($ch);
          curl_close($ch);
          return $data;
      }
      $returned_content = get_data('www.example.com');
      echo $returned_content;
  
  </pre>