PHP code example of belsrc / rest-easy

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

    

belsrc / rest-easy example snippets


Route::get('/', function() {
    $headers = array(
        'Content-Type: text/html',
        'Accept: text/html',
        'Accept-Charset: utf-8',
        'Accept-Language: en-US'
    );
    $tmp = RestEasy::get( 'http://laravel.com/', $headers );
    echo $tmp->body;
});

RestEasy::get($url, $headers)
RestEasy::post($url, $headers, $data)
RestEasy::put($url, $headers, $data)
RestEasy::delete($url, $headers)

CurlResponse::getBody()
CurlResponse::getInfo()
CurlResponse::getError()

$response->body
$response->info
$response->error
app/config/app.php

    'RestEasy' => 'Belsrc\RestEasy\Facades\RestEasy'