From e438bbf28151cbf25c88711a4a58d02e55e4a6ef Mon Sep 17 00:00:00 2001 From: Arnaud Becher Date: Tue, 11 Oct 2022 10:44:50 +0200 Subject: [PATCH] add dummy user agent to prevent 403 from picsum --- src/FakerPicsumImagesProvider.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/FakerPicsumImagesProvider.php b/src/FakerPicsumImagesProvider.php index bc431a8..4ec78b3 100755 --- a/src/FakerPicsumImagesProvider.php +++ b/src/FakerPicsumImagesProvider.php @@ -84,6 +84,7 @@ private static function fetchImage( $ch = curl_init($url); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); + curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0'); $success = curl_exec($ch) && curl_getinfo($ch, CURLINFO_HTTP_CODE) === 200; fclose($fp); curl_close($ch);