Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

phpcurl/curlhttp

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CurlHttp

Total Downloads Latest Stable Version Travis Build SensioLabs Insight

The simplest cURL HTTP client for PHP

Install

Via composer: $ composer require "phpcurl/curlhttp"

Usage

<?php
use PHPCurl\CurlHttp\HttpClient;

$http = new HttpClient();

$response = $http->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

/*

<!doctype html>
<html>
...
</html>

 */

$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',
);

 */

About

The simplest cURL HTTP client for PHP

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.