From 04a1bc2fcb8ad3a3fdc863e8a32d0779f3f3a6ea Mon Sep 17 00:00:00 2001 From: Administrator Date: Sat, 11 Dec 2021 17:29:52 +0800 Subject: [PATCH] 1 --- src/AsyncClient.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/AsyncClient.php b/src/AsyncClient.php index bad6732..fc6ad4d 100644 --- a/src/AsyncClient.php +++ b/src/AsyncClient.php @@ -83,13 +83,17 @@ class AsyncClient extends ClientAbstracts $this->client->enableSSL(); } $this->client->set($this->settings()); + if (!empty($this->getAgent())) { + $this->withAddedHeader('User-Agent', $this->getAgent()); + } else { + $this->withAddedHeader('User-Agent', ' Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36'); + } $path = $this->setParams($path, $data); $content = $this->getData()->getContents(); $this->withAddedHeader('Accept', ' text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'); - $this->withAddedHeader('User-Agent', ' Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36'); $this->withAddedHeader('Accept-Encoding', 'gzip, deflate'); $this->withAddedHeader('Content-Length', $this->getData()->getSize());