How do i do HTTP basic authentication using Guzzle

2019-03-08 23:42发布

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 using guzzle.

7条回答
一纸荒年 Trace。
2楼-- · 2019-03-09 00:10

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.

查看更多
登录 后发表回答