Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F13143665
DownloadWithWget.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
789 B
Referenced Files
None
Subscribers
None
DownloadWithWget.php
View Options
<?php
trait
DownloadWithWget
{
/**
* @return string
*/
private
function
getTemporaryFilename
()
{
$dir
=
sys_get_temp_dir
();
return
tempnam
(
$dir
,
"http-client-wget-"
);
}
/**
* Gets the content of the specified URL, using wget to download it
*
* @return string
*/
function
getFileContents
(
$url
)
{
$file
=
$this
->
getTemporaryFilename
();
$url
=
escapeshellarg
(
$url
);
system
(
"wget -q -O $file $url"
);
$data
=
file_get_contents
(
$file
);
unlink
(
$file
);
return
$data
;
}
/**
* Downloads the URL through wget and fill data properties
*/
function
get_data
()
{
$this
->
data
=
$this
->
getFileContents
(
$this
->
url
);
$this
->
encodeData
();
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Nov 21, 16:47 (1 d, 9 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3186608
Default Alt Text
DownloadWithWget.php (789 B)
Attached To
Mode
rSTG Source templates generator
Attached
Detach File
Event Timeline
Log In to Comment