我有此卷曲请求:
curl -k -H"Authorization: Bearer 905290532905902390523905krai20" https://example.com/something?limit=1
Bearer
是token_type( $token_type
)。长字符串是访问令牌($access_token
)
如何将其转换为Guzzle请求?我已经将另一个卷曲的帖子请求转换为guzzle,但这不是同一笔交易。
好吧,我一生中从未使用过这个图书馆,但是经过快速查看文档,看来这应该有效:
$client = new GuzzleHttpClient([
'base_uri' => 'https://example.com/something?limit=1'
]);
$client->request('GET', '/get', [
'headers' => [
'Authorization' => 'Bearer 905290532905902390523905krai20',
]
]);