PHP code example of mateodioev / request

1. Go to this page and download the library: Download mateodioev/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/ */

    

mateodioev / request example snippets




use Mateodioev\Request\Request;

# Start request
$req = new Request;
$req->Init($url, $curlopt_options); // $curlopt_options is opcional

$req->setMethod('GET');  // GET, HEAD, POST, PUT, DELETE, PATCH


# Start request static
$req = Request::http_method_name($url, $curlopt_options);

# Run request
$res = $req->Run($endpoint); // $endpoint is optional
echo $res

$req = Request::GET('https://netotf.space/v1/api');
$res = $req->Run('/http-cat/200');
$res->toJson(true); // Parse body responde to json
// Headers info
$res->getHeaderRequest('Host')[0];
$res->getHeaderResponse('x-author')[0];

$res->setDebug(true); // Print all request info
echo $res // Print