title: Looping for certain count for curl post
body: <p>I am new here to get answers for my issues, hoping for your kind advice. Thanks in advance.</p>
  
  <p>I have written a HTTP API to send SMS using curl. Everything is working fine, except I am failing to loop and post curl for certain phone numbers. For example: User uploads 50000 phone numbers using excel sheet on my site, I fetch all the mobile numbers from the database, and then post it through CURL.</p>
  
  <p>Now the sms gateway which I send the request accepts only maximum 10000 numbers at once via http api.</p>
  
  <p>So from the 50000 fetched numbers I want to split the numbers to 10000 each and loop that and send curl post.</p>
  
  <p>Here is my code</p>
  
  <pre><code>    //have taken care of sql injection on live site
      $resultRestore = mysql_query("SELECT * FROM temptable WHERE userid = '".$this-&gt;user_id."' AND  uploadid='".$uploadid."' ");
      $rowRestoreCount = mysql_num_rows($resultRestore);
      @mysql_data_seek($resultRestore, 0); 
      $phone_list = "";
      while($rowRestore = mysql_fetch_array($resultRestore))
      {
          $phone_list .= $rowRestore['recphone'].","; 
      }
  
      $url = "http://www.smsgatewaycenter.com/library/send_sms_2.php?UserName=".urlencode($this-&gt;param[userid])."&amp;Password=".urlencode($this-&gt;param[password])."&amp;Type=Bulk&amp;To=".urlencode(substr($phone_list, 0, -1))."&amp;Mask=".urlencode($this-&gt;sendname)."&amp;Message=Hello%20World";
      //echo $url;
      $ch = curl_init($url);  
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      $curl_scraped_page = curl_exec($ch);
      curl_close($ch); 
  </code></pre>
  
  <p>Now, from the <code>$phone_list</code>, I need to loop for every 10000 numbers, How can I achieve this?</p>
  
  <p>Its been 2 days, I have tried several things and not getting the result.</p>
  
  <p>Kindly help... </p>