Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Http\Controllers;
- use GuzzleHttp\Client;
- class JSONController extends Controller {
- //
- public function test() {
- $client = new Client();
- //$res = $client->get('http://api.icndb.com/jokes/random', 'GET');
- $res = $client->request('POST', 'http://api.icndb.com/jokes/random', [
- 'random' => [
- 'firstName' => 'John',
- 'lastName' => 'Doe',
- ],
- ]);
- echo $res->getBody(); // { "type": "User", ....
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement