fishtail/http

Http GET and POST methods.

v1.0.1 2020-08-21 04:22 UTC

This package is auto-updated.

Last update: 2024-11-13 11:02:29 UTC


README

经常在项目里面会用上GET和POST请求方法,使用封装好的方法会方便很多。

一、安装

composer require fishtail/http

二、使用

1. 导入

use Fishtail\Http;

2. GET请求

$res = Http::get('https://www.baidu.com');

3. POST请求

$url = 'http://example.com';
$header = [
	'Accept: */*',
	'Content-Type: text/plain;charset=UTF-8'
];
$cookie = 'token=2f2568ae-75f0-4ba9-98d4-8c139dad7f64';
$postData = [
	'page' => 1,
	'pageSize' => 20
];
$res = Http::post($url, $postData, $cookie, $header);

三、参数解释

1. GET方法

1. POST方法