FacturaScripts

DownloadTools
in package

Description of DownloadTools

Tags
author

Carlos García Gómez [email protected]

deprecated

since version 2023

Table of Contents

TIMEOUT  = 30
USERAGENT  = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'
$lastHttpCode  : int
download()  : bool
Downloads file from selected url.
getContents()  : string
Downloads and returns url content with curl or file_get_contents.
getHeaders()  : array<string|int, mixed>
getLastHttpCode()  : int
curlRedirectExec()  : string
Alternative function when followlocation fails.
log()  : MiniLog

Constants

USERAGENT

public mixed USERAGENT = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'

Properties

Methods

download()

Downloads file from selected url.

public static download(string $url, string $filename[, int $timeout = self::TIMEOUT ]) : bool
Parameters
$url : string
$filename : string
$timeout : int = self::TIMEOUT
Return values
bool

getContents()

Downloads and returns url content with curl or file_get_contents.

public static getContents(string $url[, int $timeout = self::TIMEOUT ]) : string
Parameters
$url : string
$timeout : int = self::TIMEOUT
Return values
string

getHeaders()

public static getHeaders(string $url[, int $timeout = self::TIMEOUT ]) : array<string|int, mixed>
Parameters
$url : string
$timeout : int = self::TIMEOUT
Return values
array<string|int, mixed>

getLastHttpCode()

public static getLastHttpCode() : int
Return values
int

curlRedirectExec()

Alternative function when followlocation fails.

private static curlRedirectExec(resource &$ch, int &$redirects) : string
Parameters
$ch : resource
$redirects : int
Return values
string

Search results