Copy a file from one server to another

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tscott
    New Member
    • Jul 2007
    • 22

    Copy a file from one server to another

    If the permissions are set to 777 of all files and all directories. Is there a possible way to do it without having to download it and upload it again? I don't expect this to work on PHP files. I'm thinking .exe files, etc...

    I've tried using fopen() and fread() and also file_get_conten ts().
    Neither of which worked to get the file, although, oddly, didn't return an error.

    If anyone knows about this can you please let me know?

    Thanks
    ~Tyler
  • tscott
    New Member
    • Jul 2007
    • 22

    #2
    I was going to edit my post and say that I don't have FTP access to this server. Although I want to use this to legally get a file and transfer it to my server without having to download and upload it. I've searched google and everywhere. Can't find a tutorial. Maybe there is a way to do it via CURL?

    Comment

    • pbmods
      Recognized Expert Expert
      • Apr 2007
      • 5821

      #3
      Heya, tscott.

      What kinds of files are these? If they are PHP files, you won't be able to fetch them via cURL nor using file_get_conten ts() because the remote server will evaluate any scripts that you try to fetch via HTTP.

      Comment

      • tscott
        New Member
        • Jul 2007
        • 22

        #4
        I said they weren't PHP files, I meant for an example an *.exe file or a *.html file.

        A file that any user could download and upload.
        All I end up with is a blank file.

        Is that possible.

        Comment

        • pbmods
          Recognized Expert Expert
          • Apr 2007
          • 5821

          #5
          Heya, Tyler.

          Hm.

          The easiest thing to do would be to download them and then upload them again. Not a whole lot of fun, but when's the last time you backed up all your server's files anyway?

          In terms of "no error, no content", note that file_get_conten ts() and fread() generate errors of E_NOTICE severity when they encounter HTTP errors (e.g., 404 not found). Most developers turn off these errors because they are non-critical and generally annoying.


          [EDIT: Though I never said that most developers SHOULD do this... nudge, nudge.]

          Comment

          • kovik
            Recognized Expert Top Contributor
            • Jun 2007
            • 1044

            #6
            Servers can control everything that you do while on the server. You may be downloading from a server that doesn't allow external referrers to access their content.

            Try simply loading their file as a part of a page using cURL, and turn on the header display so you can see if you have access or not.

            Comment

            Working...