PHP code example of kmvan / request
1. Go to this page and download the library: Download kmvan/request 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/ */
kmvan / request example snippets
use Kmvan/Request;
$req = new Request();
$req
->setBasicUrl('https://example/path/to') // set url
->setQuery([ // set url query
'age' => '19',
])
->addHeader('X-Token', '...') // add header
->setBody([ // set json post data
'name' => 'Jack',
]);
[
'status' => $status, // http status code
'data' => $data, // results json data
'raw' => $raw, // results string data
'info' => $info, // curl_getinfo() returns
] = $req->POST(); // create a POST method request