Jump to content

Recommended Posts

I'm using ftp_fget in one of my scripts, when i run it i get this error:

[18-Oct-2007 03:06:17] PHP Warning:  ftp_fget() [<a href='function.ftp-fget'>function.ftp-fget</a>]: Port ok. in /home/teck/public_html/myscript.php on line 14

[18-Oct-2007 03:07:17] PHP Warning:  ftp_fget() [<a href='function.ftp-fget'>function.ftp-fget</a>]: Port ok. in /home/teck/public_html/myscript.php on line 14

 

Heres my code:

<?php
$remotefile = "/path/to/the/file/i/want/to/download/my_file.cfg";
$localfile = 'mylocalfile.txt';
$handle = fopen($localfile, 'w');
$connid = ftp_connect($ftpserver);
ftp_login($connid, $ftpusername, $ftpuserpass);
ftp_fget($connid, $handle, $remotefile, FTP_ASCII, 0)
ftp_close($connid);
fclose($handle);
?> 

 

Any ideas as to why this happens?

Link to comment
https://forums.phpfreaks.com/topic/73763-php-warning-ftp_fget/
Share on other sites

<?php

// path to remote file
$remotefile = '/path/to/the/file/i/want/to/download/my_file.cfg';
$localfile = 'mylocalfile.txt';

// open some file to write to
$handle = fopen($localfile, 'w');

// set up basic connection
$connid = ftp_connect($ftpserver);

// login with username and password
$loginresult = ftp_login($connid, $ftpusername, $ftpuserpass);

// try to download $remotefile and save it to $handle
if (ftp_fget($connid, $handle, $remotefile, FTP_ASCII, 0)) {
echo "successfully written to $localfile\n";
} else {
echo "There was a problem while downloading $remotefile to $localfile\n";
}

// close the connection and the file handler
ftp_close($connid);
fclose($handle);
?> 

 

try that

Link to comment
https://forums.phpfreaks.com/topic/73763-php-warning-ftp_fget/#findComment-372169
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.