rdx/http

A simple HTTP wrapper around CURL, with request and response classes.

Installs: 81

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/rdx/http

1.3 2019-06-30 01:12 UTC

This package is not auto-updated.

Last update: 2025-09-28 07:46:20 UTC


README

Super simple, very imcomplete, very small wrapper around CURL.

If you need decent cookie handling, use Guzzle etc.

Request

GET

use rdx\http\HTTP;

$request = HTTP::create('https://api.github.com/gists/public');
$response = $request->request();

POST

use rdx\http\HTTP;

HTTP::$_agent = 'Some custom user agent string 1.0';

$request = HTTP::create('https://api.github.com/gists/public', array(
	'method' => 'POST',
	'data' => array('foo' => 'bar'),
	'headers' => array(
		'Authorization: Basic abc',
	),
	'cookies' => array(
		array('name', 'value'),
	),
));
$response = $request->request();

Response

var_dump($response->code);   // 200
var_dump($response->status); // OK

print_r($response->cookies_by_name);