Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.45 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Http\Controllers;
  4. use GuzzleHttp\Client;
  5.  
  6. class JSONController extends Controller {
  7.     //
  8.  
  9.     public function test() {
  10.         $client = new Client();
  11.  
  12.         //$res = $client->get('http://api.icndb.com/jokes/random', 'GET');
  13.         $res = $client->request('POST', 'http://api.icndb.com/jokes/random', [
  14.             'random' => [
  15.                 'firstName' => 'John',
  16.                 'lastName' => 'Doe',
  17.             ],
  18.         ]);
  19.         echo $res->getBody(); // { "type": "User", ....
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement