Jump to content

Site to site transfers


Hitman6267

Recommended Posts

Hi, i have 2 sites, and because of my slow connection im looking for a way to transfer files from site A to site B. I use SmartFTP is my FTP client, i tried to drag and drop file X from Site A to site B it told me i wont open a connection to ip of site onlu to another ip. I was wondering is there a way for me to transfer the files ?

Question #2 : is there a script that makes ther site download a file. Here is what i mean suppose i have a file at www.mysite.com/folder/file.rar is there a script i can install at another site that will download the "file.rar" and store it in specified location ?

Thank you :rolleyes:

Link to comment
Share on other sites


  • Replies 16
  • Views 4.4k
  • Created
  • Last Reply

I dont know about servers but from newbies views (me) i would save as and then upload to site B :rolleyes:

Link to comment
Share on other sites


I dont know about servers but from newbies views (me) i would save as and then upload to site B :rolleyes:

My internet speed is slow, it takes me long enough to upload to the first site.... thats why i want to know how i can site transfer.

Link to comment
Share on other sites


as for the site to site transfer SCRIPT...

CODE
<?php

function wwwcopy($get){

// get the basic crap together

$new basename($get);

$new str_replace("%20"" "$new);

$new str_replace("%40""@"$new);

$file "/home/_your_acct_name_/public_html/files/" $new;

$fp = @fopen($get"rb");

if($fp){

$fp2 = @fopen($file"w");

} else {

exit("<b>ERROR - Connection could not be made with file server.</b>");

}

$count 0;

// here's the actual download code

if($fp2){

echo "<b>Connection opened, retrieving file...</b><br>";

while(!feof($fp)){

$cont fread($fp4096);

$status socket_get_status($fp);

if(connection_status() != 0){

fclose($fp);

fclose($fp2);

exit;

} elseif($status['timed_out']) {

fclose($fp);

fclose($fp2);

exit("<br><b>ERROR - Connection with file server was broken and/or timed out.</b>");

}

fwrite($fp2$cont);

$cont "";

if($count == 245){

echo "<br>.";

$count 1;

} else {

echo ".";

$count++;

}

}

fclose($fp);

fclose($fp2);

} else {

exit("<br><b>ERROR - Could not create a local dump file.</b>");

}

exit("<br><b>Download complete!</b>");

}

if(isset($_REQUEST["get"])){

$toget $_REQUEST["get"];

$toget str_replace(" ""%20"$toget);

$toget str_replace("@""%40"$toget);

$toget str_replace("'""%27"$toget);

wwwcopy($toget);

}

else{

exit(" ");

}

?>

...usage...

http://mysite.com/filegrabber.php?get=http://othersite.com/filename.exe

...notes...

1. you need PHP support WITH remote connections enabled, obviously

2. you need to CHMOD the destination folder, /files/ if this case, to 777

...should work beyond that tho, and the files are buffered at 4K too so there shouldn't be any resource issues with even the biggest of files :rolleyes:

Link to comment
Share on other sites


Thank you ! lol i dont know what else to say. But now your going to find out that im a complete noob... :rolleyes:

So i copy paste the php code into a php file, i didnt get the usage though ;) ! Sorry for being this "nooby" lol

Link to comment
Share on other sites


oh, actually, that's my fault (getting too used to my download scripts) ;)

fixed it tho, i think you'll understand it now :rolleyes:

Link to comment
Share on other sites


  • 3 months later...

Sorry to bump this old thread but i'm having problems with the script. I want to download an .mp3 file off of my friend's site, when telling it to download i get this error " ERROR - Connection could not be made with file server. " guess it has to do with this part of the script

	$fp = @fopen($get, "rb");
if($fp){
$fp2 = @fopen($file, "w+");
} else {
exit("<b>ERROR - Connection could not be made with file server.</b>");
}

I think because when clicking on mp3 files windows usual plays them, the setting is if it's an extention is to be played to give the error at least that's what i made out of it. Could some one tell me how to fix it ? And if any one has time to spare could u add to the script a drop list for how many downloads i want and fields to enter the urls ? Now i do it by get= url of the file.

This is what i mean:

(open the script by my browser) i get this page:

" File number: [Drop list] or any efficient methode to add the fields without re-loading if possible

Fille 1 url :

File 2 url :

..... "

Thank you ;)

Link to comment
Share on other sites


try removing this line from the code, it's near the bottom and i've quoted it out in the example above...

$toget = str_replace("%20", " ", $toget);

Link to comment
Share on other sites


ok, had to do some actual testing to fix it (usually i can just think my way out of it) :P

any ways, i've updated the code above, note these changes...

$new = basename($get);
$new = str_replace("%20", " ", $new); //new
$new = str_replace("%40", "@", $new); //new

and

$toget = $_REQUEST["get"];
$toget = str_replace(" ", "%20", $toget); //new
$toget = str_replace("@", "%40", $toget); //new

so it turns out i was over thinking myself all along, as PHP already decodes URL characters in $_REQUEST and $_GET strings. so i needed to the exact opposite of what i was doing before...re-encode those characters ;)

Link to comment
Share on other sites


It worked :P thank you very much ;)

Edit: It didn't work with one file, i've pme'd you it's url hope that's ok.

Link to comment
Share on other sites


  • 2 months later...

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...