1. Go to this page and download the library: Download bolster/http 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/ */
bolster / http example snippets
{
" "bolster/http": "0.8"
}
}
$http = new Bolster\Http();
$response = $http->get('https://qiita.com/api/v1/users/L_e_k_o');
echo $response;
$http = new Bolster\Http();
$parser = new Bolster\Http\Parser\JsonParser();
$http->setParser($parser);
$http->setHeaders('Accept', 'application/vnd.github.v3+json');
$http->setHeaders('User-Agent', 'Bolster-Http-Module');
$json = $http->get('https://api.github.com/users/Leko');
var_dump($json);
$http = new Bolster\Http();
$http->setHttpContextOptions('ignore_errors', false);
$http->get('http://hogehoge.com/404');
PHP Warning: file_get_contents(http://hogehoge.com/404?): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /PATH/TO/source/Bolster/Http/Request.php on line 101
PHP Stack trace: ...
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.