Skip to content

Commit 032ee41

Browse files
author
Openset
committed
Add: post
1 parent 3a280a5 commit 032ee41

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"description": "Http request for php",
44
"type": "library",
55
"require": {
6+
"php": ">=5.6",
67
"guzzlehttp/guzzle": "^6.3"
78
},
89
"license": "MIT",

src/HttpClient.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,19 @@ public static function get($uri, array $options = [])
5959
return self::request('GET', $uri, $options);
6060
}
6161

62+
/**
63+
* @param $url
64+
* @param array $options
65+
* @return bool|\Psr\Http\Message\StreamInterface
66+
* @throws \GuzzleHttp\Exception\GuzzleException
67+
*/
68+
public static function post($url, array $options = [])
69+
{
70+
$key = is_array($options) ? 'form_params' : 'body';
71+
72+
return self::request('POST', $url, [$key => $options]);
73+
}
74+
6275
/**
6376
* @param $method
6477
* @param array $args

0 commit comments

Comments
 (0)