PHP code example of tal7aouy / yusr
1. Go to this page and download the library: Download tal7aouy/yusr 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/ */
tal7aouy / yusr example snippets
use Yusr\Http\YusrClient;
// Get the YusrClient instance
$client = YusrClient::getInstance();
// Make a GET request
$response = $client->get('https://jsonplaceholder.typicode.com/posts');
// Access response data
$statusCode = $response->getStatusCode();
$body = $response->getBody()->getContents();
$headers = $response->getHeaders();
echo $body. PHP_EOL;
$client = YusrClient::getInstance([
'timeout' => 60,
'allow_redirects' => false,
'verify' => false,
]);