Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F56961161
DownloadWithWget.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
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 13, 20:05 (2 d, 3 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4244047
Default Alt Text
DownloadWithWget.php (789 B)
Attached To
Mode
rSTG Source templates generator
Attached
Detach File
Event Timeline
Log In to Comment