473,386 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

ftp_fget

Hi

There is an odd problem.
The following works fine on one web server, but the same code hangs on a
different server.
I can login but the problem is at the following line.

$down=ftp_fget($connect,$handle,$remotefile,FTP_BI NARY);

Any ideas why this is happening?

Regards
John


Jul 16 '07 #1
2 1428
C.
On 16 Jul, 11:52, "John" <john1...@yahoo.comwrote:
Hi

There is an odd problem.
The following works fine on one web server, but the same code hangs on a
different server.
I can login but the problem is at the following line.

$down=ftp_fget($connect,$handle,$remotefile,FTP_BI NARY);

Any ideas why this is happening?
FTP uses a second connection for data (first connection used for
control) which can cause problems with firewalls. Try using passive
mode (ftp_pasv())

HTH

C.
Jul 16 '07 #2

"C." <co************@gmail.comwrote in message
news:11*********************@n2g2000hse.googlegrou ps.com...
On 16 Jul, 11:52, "John" <john1...@yahoo.comwrote:
>Hi

There is an odd problem.
The following works fine on one web server, but the same code hangs on a
different server.
I can login but the problem is at the following line.

$down=ftp_fget($connect,$handle,$remotefile,FTP_B INARY);

Any ideas why this is happening?

FTP uses a second connection for data (first connection used for
control) which can cause problems with firewalls. Try using passive
mode (ftp_pasv())

HTH

C.
You're right. I added the ftp_pasv and we're working again.

$login=ftp_login($connect,$user,$pass);
if (!$login) die ("Unable to login." . $lf . $dot);
ftp_pasv($connect,true);
$down=ftp_fget($connect,$handle,$remotefile,FTP_BI NARY);

But where has this firewall appeared from? The program was working OK on
both servers.
And I haven't touched anything!

Regards
John


Jul 17 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Michael T. Peterson | last post by:
I am trying to get the file referenced by the following url: http://waterdata.usgs.gov/wa/nwis/uv?dd_cd=01&dd_cd=02&format=rdb&period=1&site_no=12149000 I'm using parse_url to get the host,...
0
by: rstuckart | last post by:
A script successfully connects to a remote server, logs in, reports the size of a file on the server. The problem is that it will not download the file with either ftp_get or ftp_fget. The...
2
by: cyberpunk | last post by:
Hi guys! I have a problem with php function ftp_fget: I try to get file from ftp server and save it to disk, but when i look at downloaded file it is first symbol missing there... what can it be?...
8
by: Eric Anderson | last post by:
I have some files that sit on a FTP server. These files contain data stored in a tab-separated format. I need to download these files and insert/update them in a MySQL database. My current basic...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.