Laravel Test HTTP Client Calls

  • Get a test url from  https://webhook.site/
  • Make sure Laravel and Guzzle are installed
  • Go to a directory where Laravel is install.  Run
    php artisan tinker
  • Create a HTTP client
     $client = new \GuzzleHttp\Client();
  • Issue HTTP calls For example:
    $res = $client->request('POST', https://webhook.site/your_url_id, ['query' => ['key1' => 'values1', 'key2' => 'value2'], 'verify' => false])`;

    or

    $res = $client->request('POST', 'https://webhook.site/your_url_id', ['body' => json_encode(['key1' => 'values1', 'key2' => 'value2']), 'verify' => false]);
  • You will see the details of your calls on webhook.site.
  • Note:  to pass 2d array into body, use the json field and do not json_encode the array.