lisgroup/curl-http

lisgroup curl-http

1.3.0 2019-02-18 09:54 UTC

This package is auto-updated.

Last update: 2024-09-19 16:53:04 UTC


README

安装

要安装PHP curl-http

composer require lisgroup/curl-http

需求

支持的PHP版本:5.3+

快速入门与示例

新功能:获取 Http 类的实例

require __DIR__ . '/vendor/autoload.php';

use \Curl\Http;

// Get Class `Http` instances
$http = Http::getInstent(); // Old Version: $http = new Http();

$result = $http->request('https://www.example.com/');
var_dump($result);

GET 方法。

// https://www.example.com/search?key=keyword
$curl = Http::getInstent(); // Old Version: $curl = new Http();
$result = $curl->get('https://www.example.com/search', array(
    'key' => 'keyword',
));
var_dump($result);

POST 方法。

// https://www.example.com/login
$curl = Http::getInstent(); // Old Version: $curl = new Http();
$curl->post('https://www.example.com/login', array(
    'username' => 'myusername',
    'password' => 'mypassword',
));