corealg/curl
Composer 安装命令:
composer require corealg/curl
包简介
Curl helper for php.
README 文档
README
Install
Via Composer
$ composer require corealg/curl
Quick Start and Examples
# GET Request use CoreAlg\Curl; $curl = new Curl(); $response = $curl->get('https://www.lipsum.com/'); var_dump($response);
# GET Request With Custom Options use CoreAlg\Curl; $curl = new Curl(); $options = [ CURLOPT_HTTPHEADER => [ "Content-Type: application/json", "Authorization: Bearer TOKEN" ] // You can add options as many as you need ]; $response = $curl->get('https://www.lipsum.com/', $options); var_dump($response);
# Get Content Length Via GET Request use CoreAlg\Curl; $curl = new Curl(); // Set custom options and send it to getFileSize function as second argument [OPTIONAL] // $options = [ // CURLOPT_HTTPHEADER => [ // "Content-Type: application/json", // "Authorization: Bearer TOKEN" // ] // // You can add options as many as you need // ]; $response = $curl->getFileSize("https://dummyimage.com/250/ffffff/000000"); var_dump($response);
# POST Request use CoreAlg\Curl; $curl = new Curl(); $data = [ // Your data array ]; $options = []; $response = $curl->post('https://www.lipsum.com/', $data, $options); var_dump($response)/ // NOTE: $data and $options both are optional parameter // NOTE: $data array will be converted to json before execute request, so you do not need to worry about it just feel free to make and pass your $data array
# PATCH Request use CoreAlg\Curl; $curl = new Curl(); $data = [ // Your data array ]; $options = []; $response = $curl->patch('https://www.lipsum.com/', $data, $options); var_dump($response); // NOTE: $data and $options both are optional parameter // NOTE: $data array will be converted to json before execute request, so you do not need to worry about it just feel free to make and pass your $data array
统计信息
- 总下载量: 199
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-12-13