This commit is contained in:
Abdulrahman
2019-05-25 00:30:55 +03:00
parent 5a18924efa
commit 8b46a52466
13 changed files with 199 additions and 205 deletions

View File

@@ -16,10 +16,10 @@ if (! defined('IN_COMMON'))
class FetchFile
{
private $url;
private $timeout = 60;
private $timeout = 60;
private $destinationPath = '';
private $maxRedirects = 3;
private $binary = false;
private $maxRedirects = 3;
private $binary = false;
public function __construct($url)
@@ -91,9 +91,9 @@ class FetchFile
protected function finishUp()
{
if(defined('KJ_SESSION'))
if (defined('KJ_SESSION'))
{
session_id(constant('KJ_SESSION'));
session_id(constant('KJ_SESSION'));
}
session_start();
@@ -138,6 +138,7 @@ class FetchFile
else
{
$data = curl_exec($ch);
if ($data === false)
{
kleeja_log(sprintf("FetchFile error (curl: #%d): %s\n", curl_errno($ch), htmlspecialchars(curl_error($ch))));
@@ -150,8 +151,8 @@ class FetchFile
protected function fopen()
{
// Setup a stream context
$stream_context = stream_context_create(
// Setup a stream context
$stream_context = stream_context_create(
[
'http' => [
'method' => 'GET',
@@ -179,6 +180,11 @@ class FetchFile
return $content;
}
else
{
$error = error_get_last();
kleeja_log(sprintf("FetchFile error (stream: #%d): %s\n", $error['type'], $error['message']));
}
return false;
}