PHP code example of madnh / request

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

    

madnh / request example snippets


Request::globalConfig('cookie_send', __DIR__.'/cookie.txt');
Request::globalConfig('cookie_save', __DIR__.'/cookie.txt');

$obj = new Request(array(
    'timeout' => 10
));
$result = $obj->request(array(
    'url' => 'http://www.w3schools.com/'
));
print_r($result);

$result = Request::url($_SERVER['HTTP_HOST'] . '/test/target.php')
        ->addData('name', 'Tom')
        ->addData('old', 16)
        ->setCookie(array(
            'is_admin' => true
        ))
        ->ajaxRequest()
        ->post();