summaryrefslogtreecommitdiffstats
path: root/README.md
blob: e5da2afad89522a3add0a854af3e2844c89db134 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# php.curl

**PCurl** is a PHP client library for [RESTful](http://en.wikipedia.org/wiki/Representational_State_Transfer) 
web services.

PCurl supports GET/POST/PUT/DELETE request methods. Unlike other similar libaries supports also HTTPS certificates verification.

Composer Installation
------------

To install PCurl, use the following composer `require` statement:
```
{
    "require": {
        "purplecode/pcurl": "dev-master"
    }
}

```

Usage
------------

Simple GET
```
$pcurl = new PCurl('http://www.google.pl');
$response = $cut->get('/');
```

Simple GET via HTTPS with certificate verification (more examples in test package)
```
$pcurl = new PCurl('https://www.google.pl');
$cut->useSSLCertificate(<path to crt/pem file>);
$response = $cut->get('/');
```
and a similar example without it
```
$pcurl = new PCurl('https://www.google.pl');
$cut->ignoreSSLCertificate();
$response = $cut->get('/');
```

Sample POST
```
$pcurl = new PCurl('http://some.fancy.page');
$cut->proxy(host, port);
$cut->auth(user, pass);
$cut->header('Cache-Control: no-cache');
$cut->contentType('application/xml');
$response = $cut->post('<a>makapaka</a>');
```

Enjoy!