Skip to content

Instantly share code, notes, and snippets.

@ajaxray
ajaxray / pecl_http_snippets.php
Last active April 13, 2017 10:59
Using version 2 of PECL HTTP extension (pecl_http)
<?php
// Doc Home - http://devel-m6w6.rhcloud.com/mdref/http
$url = 'http://php.net';
// ## Simple single Get
$req = new \http\Client\Request('GET', $url);
$client = (new \http\Client())
->enqueue($req)
->send();