title: How to run cURL once, checking domain availability in a loop? Help fixing code please
body: <p>What I have in place, is a domain availability check, which connects up to an API and outputs "Available: and Unavailable:" from $tmp. Ths below code will only check the availability ONCE.</p>
  
  <p>I would like to check the availability of the domain, multiple times (possibly on a loop?), <strong><em>without having to run restart cURL connection everytime (as it wastes time)</em></strong>.</p>
  
  <p>I just don't know how I can connect to cURL once and run the loop (doing the check through the API).</p>
  
  <p><strong>Current code</strong></p>
  
  <pre><code>&lt;?php
  
      function GetCurlPage ($pageSpec)
      {
        $ch = curl_init($pageSpec);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
        $tmp = curl_exec ($ch);
        curl_close ($ch);
        $tmp = preg_replace('/(?s)&lt;meta http-equiv="Expires"[^&gt;]*&gt;/i', '', $tmp);
        $tmp = explode('&lt;br&gt;', $tmp);
        echo $tmp[0];
        echo "&lt;br&gt;";
        echo $tmp[1];
        echo "&lt;br&gt;";
        return $tmp;
      }
  
  $returnUrl = "http://www.mysite.com.au/check.php";
  $url = "https://www.apisite.com.au/availability/check.php?domain=testdomain&amp;suffixes=.com.au";
  $output = GetCurlPage("$url");
  
  ?&gt;
  </code></pre>