library utils-curl
This is a util for redis
limingxinleo/utils-curl
This is a util for redis
- Sunday, June 11, 2017
- by limingxinleo
- Repository
- 1 Watchers
- 0 Stars
- 16 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 4 Versions
- 0 % Grown
Curl 类
安装
composer require limingxinleo/utils-curl
使用方法
require_once 'vendor/autoload.php';
use limx\curl\Application;
$curl = new Application();
// 可以在opt中设置header
$curl->opt->setHeader("Opt-Test", 'Opt-Value');
$url = 'https://demo.phalcon.lmx0536.cn/test/api/api?get=simpleGet';
$params = [
'get1' => 1,
'get2' => 2,
];
// 在Client中设置Header
$header = [
'Client-Test' => 'Client-Value'
];
$result = $curl->client->setHeaders($header)->get($url, $params)->getJsonContent();
print_r($result);
require_once 'vendor/autoload.php';
use limx\curl\Application;
$curl = new Application();
$url = 'https://demo.phalcon.lmx0536.cn/test/api/api?get=simpleGet';
$params = [
'get1' => 1,
'get2' => 2,
];
$headers = [
'Header-Test' => '1',
];
// Content-Type=application/x-www-form-urlencoded
$result = $curl->client->setHeaders($headers)->post($url, $params)->getJsonContent();
print_r($result);
// Content-Type=json
$result = $curl->client->setHeaders($headers)->format('json')->post($url, $params)->getJsonContent();
print_r($result);
dev-master
9999999-dev
This is a util for redis
Sources
Download
MIT
The Requires