1. Go to this page and download the library: Download tmpbin/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/ */
tmpbin / http example snippets
// change this to point correctly according
// to your folder structure.
ponse = $client->get('echo.jsontest.com/key/value/something/here');
var_dump($response->json());
$response = HttpClient::get('http://example.org');
// raw content
$response->content();
$request = [
'url' => 'http://somehost.net/something',
'params' => [
'id' => '12350ME1D',
'lang' => 'en-us',
'format' => 'rss_200'
]
];
$response = HttpClient::get($request);
// raw content
$response->content();
// in case of json
$response->json();
// XML
$response->xml();
$request = [
'url' => 'http://somehost.net/somewhere',
'params' => [
'id' => '12350ME1D',
'lang' => 'en-us',
'format' => 'rss_200'
]
];
$response = HttpClient::post($request);
// raw content
$response->content();
// in case of json
$response->json();
// XML
$response->xml();