title: PHP loop curl request one by one
body: <p>How to make a <code>foreach</code> or a <code>for</code> loop to run only when the curl response is received..</p>
  
  <p>as example :</p>
  
  <pre><code>for ($i = 1; $i &lt;= 10; $i++) {
   $ch = curl_init();
   curl_setopt($ch,CURLOPT_URL,"http://www.example.com");
  
   if(curl_exec($ch)){ // ?? - if request and data are completely received
     // ?? - go to the next loop
   }
   // DONT go to the next loop until the above data is complete or returns true
  }
  </code></pre>
  
  <p>i don't want it to move to the next loop without having the current curl request data received.. one by one, so basically it opens up the url at first time, waits for the request data, if something matched or came true then go to the next loop,</p>
  
  <p>you dont have to be bothered about the 'curl' part, i just want the loop to move one by one ( giving it a specific condition or something ) and not all at once</p>