WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/download url

Description

Downloads a url to a local temporary file using the WordPress HTTP Class. Please note that the calling function must unlink() the file.

Parameters

$url
(string) (required) the URL of the file to download
Default: None
$timeout
(integer) (optional) The timeout for the request to download the file default 300 seconds
Default: 300

Return Values

(mixed) 
WP_Error on failure, string Filename on success.

Change Log

Since: 2.5

Source File

download_url() is located in wp-admin/includes/file.php