cURL wrapper for PHP applications.
Work with remote servers via cURL much easier than using the native PHP bindings.
- PHP 5.3+
- POST/GET/PUT/DELETE requests over HTTP
- HTTP Authentication
- Follows redirects
- Returns error string
- Provides debug information
Just add the following to the require section your composer.json file:
composer install to pull down the latest release.
Package details can be found at https://packagist.org/packages/bca/curl.
You may download a specific version from https://github.com/brodkinca/BCA-PHP-CURL/tags or visit the main repository at https://github.com/brodkinca/BCA-PHP-CURL/tree/master to download unreleased code or pull down a copy via git.
This library will be maintained under the Semantic Versioning guidelines.
Releases will be numbered with the following format:
And constructed with the following guidelines:
- Breaking backward compatibility bumps the major (and resets the minor and patch)
- New additions without breaking backward compatibility bumps the minor (and resets the patch)
- Bug fixes and misc changes bump the patch
Composer users who would like more granular control over upgrades should restrict their installation to patch updates only using this require key:
For more information on SemVer, please visit http://semver.org/.
Simple requests can be constructed with just a URL and a method.
$request = new CURL('http://example.com/'); $response = $request->get();
More complex requests build upon that concept by adding methods to the request.
$request = new CURL('http://example.com/'); $response = $request ->param('aaa', 'bbb') ->param('xxx', 'yyy') ->post(); echo $response;
Advanced requests can be built by adding even more methods.
$request = new CURL('http://example.com/'); $response = $request ->param('aaa', 'bbb') ->param('xxx', 'yyy') ->option(CURLOPT_PROXY, '10.0.0.1') ->auth('username', 'password', 'digest') ->delete(); echo $response;