php ftp_get和奇怪的问题,在线等

xiefangzhen 2010-07-02 06:37:20
在对方unix服务器上下载数据,文件大小都能读出来,就是内容下载不了,什么原因呀,错误提示如下
501
Warning: ftp_get() [function.ftp-get]: Opening ASCII mode data connection for 50001_Award_8_514772.txt (501 Bytes).
...全文
216 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiefangzhen 2010-07-02
  • 打赏
  • 举报
回复
帮忙看看,收不到内容
set_time_limit(600);
$ftp_server="218.249.166.200";
$conn_id = ftp_connect($ftp_server,"8221") or die("Couldn't connect to $ftp_server");
ftp_login($conn_id,"sctest","222333");
ftp_pasv($conn_id, true);
echo ftp_get($conn_id,"abc.txt","/201007/02/50001_Award_8_514772.txt",FTP_ASCII);
CunningBoy 2010-07-02
  • 打赏
  • 举报
回复
可能是因为防火墙,在ftp_get()之前加上ftp_pasv($resource, true);

原文摘自php网站文档的注释:http://php.net/manual/en/function.ftp-put.php
========================================================================
If when using ftp_put you get the one of the following errors:

Warning: ftp_put() [function.ftp-put]: Opening ASCII mode data connection

Warning: ftp_put() [function.ftp-put]: Opening BINARY mode data connection

and it creates the file in the correct location but is a 0kb file and all FTP commands thereafter fail. It is likely that the client is behind a firewall. To rectify this use:

<?php
ftp_pasv($resource, true);
?>

Before executing any put commands. Took me so long to figure this out I actually cheered when I did :D
PIGer920 2010-07-02
  • 打赏
  • 举报
回复
501的意思是:Syntax error in parameters or arguments.

贴下你的代码

21,887

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧