summaryrefslogtreecommitdiffstats
path: root/README.md
blob: 639a82417cbd592930100977c860bc8cc0b78325 (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
# 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 supoprts 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->get('/');
```

Enjoy!