Added new helper function

Added new helper function to replace file_get_contents with curl.
This commit is contained in:
Julian Prieber 2023-01-31 15:49:56 +01:00
parent ab1557110d
commit 2329d8345b
2 changed files with 15 additions and 1 deletions

View File

@ -0,0 +1,13 @@
<?php
function external_file_get_contents($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0');
$data = curl_exec($ch);
curl_close($ch);
return $data;
}

View File

@ -31,7 +31,8 @@
},
"autoload": {
"files": [
"app/Functions/findfile.php"
"app/Functions/findfile.php",
"app/Functions/externalfiles.php"
],
"psr-4": {
"App\\": "app/",