dcai / curl
PHP 的友好 cURL 封装器。
0.2.2
2018-06-11 12:09 UTC
Requires (Dev)
- phpunit/phpunit: ^5.7
This package is not auto-updated.
Last update: 2024-09-26 16:41:59 UTC
README
这是一个 PHP 封装类,用于简化使用 PHP cURL 库。
如何使用
以下代码展示了如何使用这个类
$http = new dcai\curl; // enable cache $http = new dcai\curl(array('cache'=>true)); // enable cookie $http = new dcai\curl(array('cookie'=>true)); // enable proxy $http = new dcai\curl(array('proxy'=>true)); // HTTP GET $response = $http->get('http://example.com'); // HTTP POST $response = $http->post('http://example.com/', array('q'=>'words', 'name'=>'moodle')); // POST RAW $xml = '<action>perform</action>'; $response = $http->post('http://example.com/', $xml); // HTTP PUT $response = $http->put('http://example.com/', array('file'=>'/var/www/test.txt');