mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-09 18:16:48 +01:00
Can pass text as 3rd param now for die message
This commit is contained in:
@@ -46,7 +46,7 @@ if (isset($_SESSION['text'])) {
|
||||
}
|
||||
|
||||
// Get data from a fopen or CURL connection
|
||||
function getData($url,$type='fopen',$shouldDie=false) {
|
||||
function getData($url,$type='fopen',$dieMessage=false) {
|
||||
global $context;
|
||||
|
||||
// Request is to connect via CURL
|
||||
@@ -70,11 +70,11 @@ function getData($url,$type='fopen',$shouldDie=false) {
|
||||
$data = @file_get_contents(str_replace("https:","http:",$url), false, $context);
|
||||
}
|
||||
}
|
||||
// Return data or die
|
||||
// Return data or die with message
|
||||
if ($data) {
|
||||
return $data;
|
||||
} elseif ($shouldDie) {
|
||||
die('Unable to get data over a fopen or CURL connection');
|
||||
} elseif ($dieMessage) {
|
||||
die($dieMessage);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user