gsouf / simple-curl
This package is abandoned and no longer maintained.
No replacement package was suggested.
An OOP curl wrapper for php
0.1.0
2015-10-16 12:21 UTC
Requires
- php: >=5.4.0
Requires (Dev)
- codeclimate/php-test-reporter: dev-master
- phpunit/phpunit: 4.1.2
This package is not auto-updated.
Last update: 2018-04-04 10:59:39 UTC
README
This library is made to create http request with no pain and no additional dependency.
It just aims to be simple
Usage
GET QUERY
<?php $request = new \gsouf\SimpleCurl\HttpRequest("http://httpbin.org/get?param=value"); $response = $request->exec();
POST QUERY WITH DATA
<?php $request = new \gsouf\SimpleCurl\HttpRequest("http://httpbin.org/post", "POST"); $request->setPostFields([ "field1" => "value1", "field2" => "value2" ]); $response = $request->exec();
READ RESPONSE BODY
$body = $response->getBody(); $jsonBody = json_decode($response);
READ STATUS CODE
$statusCode = $response->getStatusCode();
READ HEADERS
$headers = $response->getHeaders();