PHP code example of folour / oxide

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

    

folour / oxide example snippets


     declare(strict_types=1);
    
    use Folour\Oxide\Oxide;
    
    $oxide = new Oxide();
    $response = $oxide->get('https://google.com', ['q' => 'php 7.1']);
    
    //get response body
    echo $response->body(); //Or echo $response;
    //get response code
    echo $response->code();
    //get response headers
    var_dump($response->headers());

     declare(strict_types=1);
    
    use Folour\Oxide\Oxide;
    
    $oxide = new Oxide();
    $oxide
        ->setHeaders([
            'Referer' => 'http://local.dev'
        ])
        ->setCookies([
            'cookie' => 'value'
        ])
        ->setProxy('user:[email protected]:8080');
    
    $response = $oxide->post('http://httpbin.org/post', ['test']);

     declare(strict_types=1);
    
    use Folour\Oxide\Oxide;
    
    $oxide = new Oxide();
    
    echo $oxide->get('http://httpbin.org/get', ['key' => 'value']);
    echo $oxide->head('http://httpbin.org/get', ['key' => 'value']);
    echo $oxide->post('http://httpbin.org/post', ['key' => 'value']);
    echo $oxide->put('http://httpbin.org/put', ['key' => 'value']);
    echo $oxide->delete('http://httpbin.org/delete', ['key' => 'value']);