-3

help me to solve the problem .

I have wrote my code like this :

function copy(){
    $folder     = "PDF";
    $file       = "2016-01-001_01-00.pdf";
    $files      = "ftp://10.242.42.154/adk_rkakl2016s"." ".substr($file,8,3)."/".substr($file,12,2)."/".$folder."/"."2016-01-001_01-00.pdf";
    $newfile    = 'files/backup_file/2017-01-001_01-00.pdf';

   if (!copy($files, $newfile)) {
      echo "failed to copy $files...\n";
        }else {
      echo "copied $file into $newfile\n";
        }
} 

i want to copy file from another server, but the result like this :

Severity: Warning Message: copy(): connect() failed: Connection refused Filename: controllers/Download_adk.php Line Number: 146

please help me

  • 1
    nobody will put any effort for this question, given that you put 0 effort in structuring it. Do not post images of code, but rather use SO functionality to show us the code. Thanks – N. Ivanov Nov 28 '17 at 09:38
  • 2
    "Connection refused" = the remote server is not letting your script do this. There is no way for anyone here to tell why, you'll have to talk to the administrator of the remote server. – Pekka Nov 28 '17 at 09:38
  • Possible duplicate of [Copy file from remote server or URL](https://stackoverflow.com/questions/9843933/copy-file-from-remote-server-or-url) – Masivuye Cokile Nov 28 '17 at 09:39

1 Answers1

-1

Since it is saying connection refused, Please check whether you are able to view the PDF in browser. If you can view pdf that is on the same machine as your program, then it might be that the server won't send the pdf unless you are a real user. In that case, modifying the browser identification string might fix your problem.

If you cannot view the pdf from your browser, then I guess, we have to check for some other problem.

Penguine
  • 519
  • 6
  • 19
  • I have check in my browser, then the result is i can not view the PDF in browser, The remote server i want to access is linux, it using samba too then what should i do for next? – Little Pokis Nov 29 '17 at 01:05
  • Then check out the reason, why you are unable to view – Penguine Nov 29 '17 at 05:05