Hitman6267 Posted March 1, 2006 Share Posted March 1, 2006 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 More sharing options...
vin3e Posted March 1, 2006 Share Posted March 1, 2006 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 More sharing options...
Hitman6267 Posted March 1, 2006 Author Share Posted March 1, 2006 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 More sharing options...
Samurai Posted March 1, 2006 Share Posted March 1, 2006 FlashFXP Link to comment Share on other sites More sharing options...
nsane Posted March 1, 2006 Share Posted March 1, 2006 as for the site to site transfer SCRIPT...CODE<?phpfunction 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($fp, 4096); $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, obviously2. 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 More sharing options...
Hitman6267 Posted March 1, 2006 Author Share Posted March 1, 2006 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 More sharing options...
nsane Posted March 1, 2006 Share Posted March 1, 2006 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 More sharing options...
Hitman6267 Posted March 1, 2006 Author Share Posted March 1, 2006 Thank you alot :rolleyes: Link to comment Share on other sites More sharing options...
Hitman6267 Posted June 18, 2006 Author Share Posted June 18, 2006 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 More sharing options...
nsane Posted June 18, 2006 Share Posted June 18, 2006 PM me the url of the file in question, might be a URL encode problem ;) Link to comment Share on other sites More sharing options...
Hitman6267 Posted June 18, 2006 Author Share Posted June 18, 2006 Sent ;) Link to comment Share on other sites More sharing options...
nsane Posted June 18, 2006 Share Posted June 18, 2006 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 More sharing options...
Hitman6267 Posted June 18, 2006 Author Share Posted June 18, 2006 didnt work ;) Link to comment Share on other sites More sharing options...
nsane Posted June 18, 2006 Share Posted June 18, 2006 ok, had to do some actual testing to fix it (usually i can just think my way out of it) :Pany ways, i've updated the code above, note these changes...$new = basename($get);$new = str_replace("%20", " ", $new); //new$new = str_replace("%40", "@", $new); //newand$toget = $_REQUEST["get"];$toget = str_replace(" ", "%20", $toget); //new$toget = str_replace("@", "%40", $toget); //newso 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 More sharing options...
Hitman6267 Posted June 19, 2006 Author Share Posted June 19, 2006 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 More sharing options...
Hitman6267 Posted September 12, 2006 Author Share Posted September 12, 2006 The script isn't working with file names that have " ' " like for example " It's ". Can it be fixed ? Thank you :lol: Link to comment Share on other sites More sharing options...
nsane Posted September 13, 2006 Share Posted September 13, 2006 just add this near the bottom...$toget = str_replace("'", "%27", $toget);...also see the above example if needed again :sneaky: Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.