PHP code example of mashinamashina / request

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

    

mashinamashina / request example snippets


use MashinaMashina\Request\Request;

$request = new Request('https://github.com');
$request->send();

echo $request->response;

use MashinaMashina\Request\Request;

$request = new Request('http://google.com');
$request->session('google');
$request->send();

if( $request->error())
{
  echo $request->dump();
  die();
}

$data = array(
  'login' => 'Vasya',
  'passwd' => '12345'
);

$request = new Request('http://example.com');
$request->post($data);
$request->send();

echo $request->response;

$data = array(
  'auth' => array(
    'login' => 'Vasya',
    'passwd' => '12345'
  ),
  'order' => array(
    'id' => 1
  )
);

$request = new Request('http://example.com');
$request->payload($data);
$request->send();

echo $request->response;