PHP cURL Class With Multi-Threading
This is an object oriented wrapper for PHP cURL support; designed to cut down on the amount of bloat that is required to deal with cURL in PHP. It supports multi-threading and has a built-in retry facility that will try to re-download a URL a given number of times if it recives a HTTP header code more or equal than 400.
All of cURL facilities have been implemented in the wrapper. They are documented using the Javdoc format, so should be pretty easy for anyone familiar with using cURL to use. As standard, you will need to set CURLOPT_RETURNTRANSFER to true in order to store the results in a variable. Here are a couple of examples to get you going:
Download A URL
In the above example, cURL will attempt to download yahoo.com twice. The result will be stored in an array. The clear method clears the cURL wrapper of its sessions, allowing you to make fresh connections.
Download Multiple URLs
In this example, cURL will attempt to download three URLs at once (multi-threading) and return the results in an array.
This class is available under the MIT License.