jeudi 6 février 2020

How can I get response from guzzle in Laravel 5.3

I try like this :

$res = $client->request('POST', 'https://api.orange.com/smsmessaging/v1/outbound/tel:+phone/requests/', [
            'headers' => [
                'Accept' => 'application/json',
                'Content-Type' => 'application/json',
                'Authorization'=>'Bearer '.$token,
                /*'Content-Type' => 'application/x-www-form-urlencoded',*/
            ],
            /*'form_params' => $body ,*/
            'json' => [
                'outboundSMSMessageRequest'=>[
                'address'=> 'tel:+$phone',
                'senderAddress'=>'tel:+phone_rec',
                'outboundSMSTextMessage'=>[
                     'message'=> 'Hello test!'
                ]
            ]],
            'debug'   => true,
            'verify' => false,
                ]
        );
        $res->getStatusCode();
        // 200
        $res->getHeader('content-type');
        // 'application/json; charset=utf8'
        $res->getBody();

When executed, the result is an errror curl_setopt_array(): cannot represent a stream of type Output as a STDIO FILE* How can I get the response?

I try in postman, it success get response

But I try use guzzle, it failed



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire