Home  >  Article  >  Backend Development  >  Use PHP to remotely download files to space_PHP tutorial

Use PHP to remotely download files to space_PHP tutorial

WBOY
WBOYOriginal
2016-07-14 10:07:40904browse

I just moved my blog and planned to migrate the data between the two spaces, but I encountered some problems. The packaged files were too big. I couldn’t help it, so I thought of using PHP to download files remotely
Then I wrote a script!

01 <?php
02 if ($_GET[xfer]) {

03 if ($_POST[from] == "") {
04 print "You forgot to enter a url.";

05 } else {
06 copy("$_POST[from]", "$_POST[to]");

07 $size = round((filesize($_POST[to])/1000000), 3);
08 print "transfer complete.<br>

09 <a><a href="$_POST[from]">$_POST[from]</a><br>
10 <a><a href="$_POST[to]">$_POST[to]</a> : $size MB";

11 }
12 } else {

13 print "<form action="$PHP_SELF?xfer=true" method=post>
14 远程文件下载地址(请带上http://): <input name=from><br>

15 保存文件名: <input name=to><br>
16 <input type=submit value="transload">";

17 }
18 ?>
However, not all virtual hosts support it. It depends on whether certain functions are enabled. I don’t know what functions

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477848.htmlTechArticleI just moved my blog and planned to migrate the data from the two spaces, but I encountered some problems. The packaged files were too large. When I had no other choice, I thought of PHP to download files remotely and wrote a script...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn