private function restCall($uri, $data)
    {
        try {
            $client = new Client(['base_uri' => $this->baseUrl]);
            $response = $client->request('POST', $uri, ['json' => $data]);

            $rawBody = $response->getBody()->getContents();
            $body = json_decode($rawBody, true);
        } catch (RequestException $e) {
            $response = $e->getResponse();
            $rawBody = is_null($response) ? '{"Status":-98,"message":"http connection error"}' : $response->getBody()->getContents();
            $body = json_decode($rawBody, true);
        }

        if (!isset($result['Status'])) {
            $result['Status'] = -99;
        }

        return $body;
    }
private function restCall($uri, $data)
    {
        try {
            $client = new Client(['base_uri' => $this->baseUrl]);
            $response = $client->request('POST', $uri, ['json' => $data]);

            $rawBody = $response->getBody()->getContents();
            $body = json_decode($rawBody, true);
        } catch (RequestException $e) {
            $response = $e->getResponse();
            $rawBody = is_null($response) ? '{"Status":-98,"message":"http connection error"}' : $response->getBody()->getContents();
            $body = json_decode($rawBody, true);
        }

        if (!isset($result['Status'])) {
            $result['Status'] = -99;
        }

        return $body;
    }
private function restCall ( $ uri , $ data ) { try { $ client = new Client ( [ 'base_uri' => $ this -> baseUrl ] ) ; $ response = $ client -> request ( 'POST' , $ uri , [ 'json' => $ data ] ) ; $ rawBody = $ response -> getBody ( ) -> getContents ( ) ; $ body = json_decode ( $ rawBody , true ) ; } catch ( RequestException $ e ) { $ response = $ e -> getResponse ( ) ; $ rawBody = is_null ( $ response ) ? '{"Status":-98,"message":"http connection error"}' : $ response -> getBody ( ) -> getContents ( ) ; $ body = json_decode ( $ rawBody , true ) ; } if ( ! isset ( $ result [ 'Status' ] ) ) { $ result [ 'Status' ] = - 99 ; } return $ body ; }
request rest and return the response.

@param $uri
@param $data

@return mixed
request rest and return the response .