salvador98
10 months ago
804
10
Laravel

GuzzleHttp hang up my laravel app

Posted 10 months ago by salvador98

Hello . When I use GuzzleHttp and send the request, my laravel program is interrupted and I will stop the server and run it again. if use online api or just use localhost without port number not problem and work. but when use port 8000 or any port , laravel app hang up . My code is

    $http = new \GuzzleHttp\Client;
    $response = $http->post('http://localhost:8000/oauth/token', [
        'form_params' => [
            'grant_type' => 'password',
            'client_id' => 2,
            'client_secret' => 'AXXwkDGiuEewwd1tza4haWrz6Gku0LRGgLIaayxC',
            'username' => 'saeed',
            'password' => '12345678',
        ]
    ]);
    return json_decode((string)$response->getBody(), true);

Please sign in or create an account to participate in this conversation.