Answers for "guzzle token header"

PHP
2

guzzle bearer token

$newresponse = $basicauth->request(
    'GET',
    'api/1/curriculum',
    ['debug'   => true], 
    ['headers' => 
        [
            'Authorization' => "Bearer {$acceso->access_token}"
        ]
    ]
)->getBody()->getContents();
Posted by: Guest on May-05-2020
1

guzzle header authorization

public function __construct()
    {
        $this->client = new Client();
        $this->sms_gate_url = config('app.sms_gate.url');
        $this->sms_gate_username = config('app.sms_gate.username');
        $this->sms_gate_password = config('app.sms_gate.password');
    }


public function sendSms(string $phone, string $message)
    {
        try {
            $this->client->post($this->sms_gate_url . 'send', [
                'auth' => [$this->sms_gate_username, $this->sms_gate_password],

                'json' => [
                    "messages" => [
                        [
                            "recipient" => $phone,
                            "message-id" => "itrust" . strval(time()),

                            "sms" => [
                                "originator" => "3700",
                                "content" => [
                                    "text" => $message
                                ]
                            ]
                        ]
                    ]
                ]
            ]);
        } catch (\Exception $ex) {
            Log::error($ex);
        }
    }
Posted by: Guest on August-02-2021

Code answers related to "guzzle token header"

Browse Popular Code Answers by Language