1. Go to this page and download the library: Download weezqyd/http-adapters library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
weezqyd / http-adapters example snippets
ttp\Adapter\GuzzleHttpAdapter;
$options = [
// Base URI is used with relative requests
'base_uri' => 'http://httpbin.org',
// You can set any number of default request options.
'timeout' => 2.0,
// Pass your custom headers
'headers' => [
'Authorization' => 'your access token',
'X-Foo' => 'Bar'
]
];
// create an adapter with the options
$adapter = new GuzzleHttpAdapter($options);
// make a get request with the adapter
$response = $adapter->get('get?adappter=GuzzleAdapter');
var_dump($response);
/*
{
"args": {
"adappter": "GuzzleAdapter"
},
"headers": {
"headers": {
"Authorization": "your access token",
"X-Foo": "Bar",
"Connection": "close",
"Host": "httpbin.org",
"User-Agent": "GuzzleHttp/6.2.1 curl/7.47.0 PHP/7.1.6"
},
"origin": "0.0.0.0",
"url": "https://httpbin.org/get?adappter=GuzzleAdapter"
}
*/
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.