Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/phpcurl/curlhttp
The simplest cURL HTTP client for PHP
https://github.com/phpcurl/curlhttp
curl httlclient http php
Last synced: 25 days ago
JSON representation
The simplest cURL HTTP client for PHP
- Host: GitHub
- URL: https://github.com/phpcurl/curlhttp
- Owner: phpcurl
- License: mit
- Created: 2016-02-03T06:15:33.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-07-26T00:29:17.000Z (over 7 years ago)
- Last Synced: 2024-09-29T20:04:49.275Z (about 1 month ago)
- Topics: curl, httlclient, http, php
- Language: PHP
- Homepage: https://packagist.org/packages/phpcurl/curlhttp
- Size: 13.7 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CurlHttp
[![Total Downloads](https://img.shields.io/packagist/dt/phpcurl/curlhttp.svg)](https://packagist.org/packages/phpcurl/curlhttp)
[![Latest Stable Version](https://img.shields.io/packagist/v/phpcurl/curlhttp.svg)](https://packagist.org/packages/phpcurl/curlhttp)
[![Travis Build](https://travis-ci.org/phpcurl/curlhttp.svg?branch=master)](https://travis-ci.org/phpcurl/curlhttp)
[![SensioLabs Insight](https://img.shields.io/sensiolabs/i/bec0987d-5d9e-4895-9a34-435d5191710c.svg)](https://insight.sensiolabs.com/projects/bec0987d-5d9e-4895-9a34-435d5191710c)The simplest cURL HTTP client for PHP
## Install
Via [composer](https://getcomposer.org):
`$ composer require "phpcurl/curlhttp"`## Usage
```php
post('http://example.com/?a=b', 'my post data', ['User-Agent: My php crawler']);
// Supported: get(), post(), head(), post(), put(), delete()$body = $response->getBody(); // Response body, string
/*
...
*/
$statusCode = $response->getStatus(); // HTTP status, int
/*
200
*/
$headers = $response->getHeaders(); // HTTP response headers, array
/*array(
0 => 'HTTP/1.1 200 OK',
1 => 'Accept-Ranges: bytes',
2 => 'Cache-Control: max-age=604800',
3 => 'Content-Type: text/html',
4 => 'Date: Wed, 03 Feb 2016 07:01:58 GMT',
5 => 'Etag: "359670651"',
6 => 'Expires: Wed, 10 Feb 2016 07:01:58 GMT',
7 => 'Last-Modified: Fri, 09 Aug 2013 23:54:35 GMT',
8 => 'Server: ECS (rhv/818F)',
9 => 'Vary: Accept-Encoding',
10 => 'X-Cache: HIT',
11 => 'x-ec-custom-error: 1',
12 => 'Content-Length: 1270',
);*/
```