Skip to content

Commit 5ec6e5c

Browse files
committed
fix: add user agent header to Wikimedia image requests
Signed-off-by: notapirate <notapirate@users.noreply.github.com>
1 parent b83a417 commit 5ec6e5c

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

lib/Provider/WikimediaCommons.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public function getRandomImageUrlBySearchTerm($search, $size)
6464
$url .= '&format=json';
6565

6666
$curl = curl_init($url);
67+
curl_setopt($curl, CURLOPT_USERAGENT, $this->getUserAgent());
6768
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
6869
$response = curl_exec($curl);
6970
$json = json_decode($response, true);

lib/Provider/WikimediaCommonsDaily.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public function getRandomImageUrlBySearchTerm($search, $size)
5858
$url .= '&format=json';
5959

6060
$curl = curl_init($url);
61+
curl_setopt($curl, CURLOPT_USERAGENT, $this->getUserAgent());
6162
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
6263
$response = curl_exec($curl);
6364
$json = json_decode($response, true);

0 commit comments

Comments
 (0)