mirror of
https://github.com/LinkStackOrg/LinkStack.git
synced 2025-04-23 14:47:33 +02:00
Added new helper function
Added new helper function to replace file_get_contents with curl.
This commit is contained in:
parent
ab1557110d
commit
2329d8345b
13
app/Functions/externalfiles.php
Normal file
13
app/Functions/externalfiles.php
Normal 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;
|
||||||
|
}
|
@ -31,7 +31,8 @@
|
|||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"files": [
|
"files": [
|
||||||
"app/Functions/findfile.php"
|
"app/Functions/findfile.php",
|
||||||
|
"app/Functions/externalfiles.php"
|
||||||
],
|
],
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"App\\": "app/",
|
"App\\": "app/",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user