title: Querying an API with PHP in a parallel way
body: <p>I'm querying an API by using cURL (GET), and the API gives me only 25 results per call (it's a hard limit and there's nothing I can do about it since it's not mine).</p>
  
  <p>The results look like:</p>
  
  <pre><code>&lt;response v="2"&gt;
      &lt;query&gt;my nifty query&lt;/query&gt;
      &lt;location&gt;new york, ny&lt;/location&gt;
      &lt;totalresults&gt;920&lt;/totalresults&gt;
      &lt;start&gt;1&lt;/start&gt;
      &lt;end&gt;25&lt;/end&gt;
      &lt;pageNumber&gt;0&lt;/pageNumber&gt;
      &lt;results&gt;
          &lt;result&gt;&lt;/result&gt;
          &lt;result&gt;&lt;/result&gt;
          ...
      &lt;/results&gt;
  &lt;/response&gt;
  </code></pre>
  
  <p>The total results (which appear on the returned xml [above]) can contain up to 1,000 results, and in like most cases, I usually have 1,000 results per query, so I basically have to call the API 40 times (<em>i.e. 25 results-per-call × 40 calls = 1,000 results</em>). Every call, I change the API <em>start</em> parameter and increase it by 25 (i.e. 0, 25, 50, ..., 975).</p>
  
  <p>This whole process takes about 8 seconds to complete, as I currently call the API in a synchronous way (I'm using <code>curl_exec()</code> to execute the GET command, one by one in a for loop). Is there any efficient and faster way to call the API in a parallel way and get these results faster? Thanks.</p>