Add User-Agent header into command downloading plugins

This commit is contained in:
Jan Lysý
2024-04-18 16:23:21 +02:00
committed by Oluwaseun Olorunsola
parent 0eeb74b58c
commit f45ecefc22

View File

@ -29,7 +29,10 @@ class WPOrgPluginDownloader {
mkdir($downloadDir, 0777, true);
}
$this->httpClient->get($downloadLink, ['sink' => $downloadDir . $zip, 'headers' => ['Accept' => 'application/octet-stream']]);
$this->httpClient->get($downloadLink, ['sink' => $downloadDir . $zip, 'headers' => [
'Accept' => 'application/octet-stream',
'User-Agent' => 'MailPoet', // using user-agent to avoid 403 error
]]);
file_put_contents($downloadDir . '/' . $zip . '-info', $downloadLink);
}