title: php curl request as a foreach loop
body: <p>I have a server that requires me to send a curl response to get data back about a given phone number.</p>
  
  <pre><code>$numbers = array('12345','23456','345567','45678');
  
   foreach ($numbers as $value)
   {
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
    curl_setopt($curl, CURLOPT_USERPWD, "user:password");
    curl_setopt($curl, CURLOPT_URL, "http://server/data/user=" . $value);
  
    $ret = curl_exec($curl);
    $result = json_decode($ret,true);
  
     echo $result['someData'] . "&lt;br&gt;";
    curl_close($curl);
   }
  </code></pre>
  
  <p>my questions are:
  is this efficient?</p>
  
  <p>is there a better way? </p>
  
  <p>how can i get the echo to print to screen after each curl result, until waiting until the end of the entire script to run?</p>