2017 © Pedro Peláez
 

library utils-curl

This is a util for redis

image

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

The README.md

Curl 类

安装

composer require limingxinleo/utils-curl

使用方法

  • GET 方法
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);

  • Post
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);

The Versions

11/06 2017

dev-master

9999999-dev

This is a util for redis

  Sources   Download

MIT

The Requires

 

11/06 2017

0.1.2

0.1.2.0

This is a util for redis

  Sources   Download

MIT

The Requires

 

11/06 2017

0.1.1

0.1.1.0

This is a util for redis

  Sources   Download

MIT

The Requires

 

11/06 2017

0.1.0

0.1.0.0

This is a util for redis

  Sources   Download

MIT

The Requires