0
비동기 요청을 할 때 요청 헤더를 변경할 수 없습니다.동시 요청을위한 헤더 변경 (Guzzle)
$requests = function ($total) {
$uri = 'https://www.example.com';
$headers = [
'User-Agent' => 'testing/1.0',
'Accept' => 'application/json',
'X-Foo' => ['Bar', 'Baz']
];
for ($i = 0; $i < $total; $i++) {
yield new Request('GET', $uri, $headers); //Does not work
}
};
$pool = new Pool($client, $requests(2), [
'concurrency' => 5,
'fulfilled' => function ($response, $index) {
// this is delivered each successful response
},
'rejected' => function ($reason, $index) {
// this is delivered each failed request
},
]);
나는 내가 documentation에서 제공하는 모든 예제를 시도하고 동시 예를 제외하고 모두의 헤더를 변경 할 수 있었다 생각합니다. 어떤 도움을 주시면 감사하겠습니다.