Skip to content

Commit b290295

Browse files
committed
Update README.md
1 parent a236dc6 commit b290295

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
<center>
2+
![](https://img.shields.io/github/last-commit/Athlon1600/php-curl-client.svg)
3+
</center>
4+
15
# PHP Curl Client
26

37
A very simple curl client - less than 100 lines. Perfect for being a base class.
@@ -14,6 +18,8 @@ composer require athlon1600/php-curl-client
1418
use Curl\Client;
1519

1620
$client = new Client();
21+
22+
// returns standardized Response object no matter what
1723
$response = $client->get('https://stackoverflow.com');
1824

1925
// 200
@@ -29,6 +35,23 @@ $error = $response->error;
2935
$info = $response->info;
3036
```
3137

38+
Works with POST requests too:
39+
40+
```php
41+
$client->post('http://httpbin.org/post', ['username' => 'bob', 'password' => 'test']);
42+
```
43+
44+
or you can issue a completely customized request:
45+
46+
```php
47+
$client->request('GET', 'https://www.whatismyip.com/', null, [
48+
'User-Agent' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X)'
49+
], [
50+
CURLOPT_PROXY => '127.0.0.1:8080',
51+
CURLOPT_TIMEOUT => 10
52+
]);
53+
```
54+
3255
## TODO
3356

3457
- make PSR-7 and PSR-18 compatible

0 commit comments

Comments
 (0)