donglinxia1541 2017-03-14 21:30 采纳率: 0%
浏览 150


I have been playing around with a few php scripts trying to first at least get the php file to connect to the ftp on my distributors file and THEN i would like it to save on my file. I was going to save this as a cron to run this script daily. I can't get it to connect to the distributors ftp. Their ftp access is The exact location of the file is I can acces it with filezilla and my browser. This is a different language to me. Any help would be great!

$conn_id = ftp_connect("");
$login_result = ftp_login($conn_id, "USERNAME", "PASSWORD");

if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!";
} else {
echo "Connected";

// get the file
$local = fopen("products.xml","w");
$result = ftp_fget($conn_id, $local,"httpdocs/products.xml", FTP_BINARY);

// check upload status
if (!$result) {
echo "FTP download has failed!";
} else {
echo "Downloaded";

// close the FTP stream

If I do not use the full url to the ftp file I do not get a login when using a browser.

  • 写回答

1条回答 默认 最新


      相关推荐 更多相似问题


      • ¥20 python跨服务器实现复制 ,剪切的功能需求
      • ¥15 android sqlite数据库如何读取显示数据(语言-java)
      • ¥15 R语言,单因素cox检验,时间分层后,使用coz.zph()函数再次ph假设检验时报错,如何解决?
      • ¥15 关于#C语言冒泡排序型#的问题,如何解决?
      • ¥15 如何预处理存在负值的样本数据,使其能够全都成为正的
      • ¥15 SW画图拖影,平滑处理如何关闭
      • ¥15 请问怎么通过css改变图片颜色
      • ¥15 Blender: auto rig pro骨骼动画导出后变形穿模
      • ¥15 C51单片机的设计思路哈
      • ¥15 Linux脏牛提权漏洞