<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gaojie1592 / download_network_data_to_local example snippets
use gaojie1592\Download_Network_Data_To_Local;
$img = new Download_Network_Data_To_Local(
// 必要参数:需要下载的网络地址,必须是完整的
// Necessary parameters: the network address to be downloaded must be complete
'http://www.github.com/gif_download',
// 必要参数:保存到本地的地址,不包含文件名称,以'/'或'\'结尾
// Necessary parameters: save to the local address, do not
use gaojie1592\Download_Network_Data_To_Local;
$img = new Download_Network_Data_To_Local();
// 必要参数:需要下载的网络地址,必须是完整的
// Necessary parameters: the network address to be downloaded must be complete
$local = $img->set_http_url('http://www.github.com/jpg_download')
// 必要参数:保存到本地的地址,不包含文件名称,以'/'或'\'结尾
// Necessary parameters: save to the local address, do not
use gaojie1592\Download_Network_Data_To_Local;
$img = new Download_Network_Data_To_Local();
// 必要参数:需要下载的网络地址,必须是完整的
// Necessary parameters: the network address to be downloaded must be complete
$local = $img->set_http_url('http://www.github.com/jpg_download')
// 必要参数:保存到本地的地址,不包含文件名称,以'/'或'\'结尾
// Necessary parameters: save to the local address, do not r the file size to be downloaded, the larger the setting
->set_http_timeout(50)
// 可选参数:连接服务器的最大等待时间,如果网络不好,则设置大点
// Optional parameter: the maximum waiting time to connect to the server, if the network is not good, set a larger one
->set_http_sertimeout(50)
// 可选参数:使用代理下载
// Optional parameter: download using proxy
->set_http_proxy('192.168.0.1:1080')
// 可选参数:使用代理的账号与密码
// Optional parameters: use proxy account and password
->set_http_proxyusrpwd('usrname:password')
->start();
var_dump($local);
// 返回结果
string() "/home/www.github.com/img/filename.jpg"
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.