How do I do HTTP basic authentication using Guzzle?

前端 未结 8 1370
无人及你
无人及你 2020-12-24 00:11

I want to do basic access authentication using Guzzle and I am very new to programming. I have no clue what to do. I tried to do this using curl but my environment requires

8条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-24 01:07

    In additional to @amenadiel answer. Sometimes handy specify auth parameters in constructor:

    $client = new Client([
        'auth' => ['username', 'password'],
    ]); 
    

    Then every request will use this default auth parameters.

提交回复
热议问题