News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

upload via url is working but what if the url got a password (like so wont work)

Started by ryansdistrict, November 19, 2007, 02:35:12 PM

Previous topic - Next topic

ryansdistrict

hi all i got this code that will allow me to transfer any file from any server online to another
that is if there is a file called google.com/picture.jpg i can move that picture to my online server without downloading and re-uploading the file

the code below works perfectly for normal files but i want to transfere a mysql database from 1 server to another by the same method but the problem that the url i want to transfere to the new server is a url found under the control panel thus it is not working because it is password protected
how can modify the code below to fix this problem
<?php
if ($_GET[xfer]) {
if (
$_POST[from] == "") {
print
"You forgot to enter a url.";
} else {
copy("$_POST[from]", "$_POST[to]");
$size = round((filesize($_POST[to])/1000000), 3);
print
"Transfer complete. <br>
<a><a href=\"
$_POST[from]\">$_POST[from]</a><br>
<a><a href=\"
$_POST[to]\">$_POST[to]</a> : $size MB";
}
} else {
print
"<form action=\"$PHP_SELF?xfer=true\" method=post>
from(http://): <input name=from><br>
to(filename): <input name=to><br>
<input type=submit value=\"transload\">"
;
}
?>
For Sale: RD.com-PS.com

SleePy

Do you have access to command line on the other server?
You could use a wget or curl command line to get files. I do this all the time and it is how I currently make automated file and database backups for my sites :)

curl -O http://site.com/path/to/file.ext
Google around on how to use wget or curl if you need more information on them.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Advertisement: