Skip to content

Commit 99f6d95

Browse files
authored
Merge pull request #423 from FlorisDerks/v3.x
#421 Update alternative user-agent + also retry for 400 response code, fixes v3 Twitter issue
2 parents 0ba0aab + af2691e commit 99f6d95

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Http/CurlDispatcher.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ public function dispatch(Url $url)
102102

103103
$response = $this->exec($url, $options);
104104

105-
//Some sites returns 403 with the default user-agent
106-
if ($response->getStatusCode() === 403) {
107-
$options[CURLOPT_USERAGENT] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36';
105+
//Some sites returns 400 or 403 with the default user-agent
106+
if ($response->getStatusCode() === 400 || $response->getStatusCode() === 403) {
107+
$options[CURLOPT_USERAGENT] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36';
108108

109109
return $this->exec($url, $options);
110110
}

0 commit comments

Comments
 (0)