Kelly,

What you just described is the opposite of what you need to do. To accomplish the same thing on your AS/400, you need to do this (note that I didn't test this but you'll hopefully get the idea):

<?php
$conn = ftp_connect("QAServer");
ftp_login($conn,"username","password");
if (ftp_put($conn, "/www/zendcore/htdocs/kcookson/QAServerFile.txt",
"/MyDir/QAServerFile.txt", FTP_ASCII)) {
print ("<br />ftp get successful");
} else {
print ("<br />ftp get not successful");
}
$close = ftp_close($conn);
?>

This script is making the assumption that QAServer has FTP services running and that "MyDir" is set up as an FTP location.

Matt

-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf Of Kelly Cookson
Sent: Wednesday, July 15, 2009 10:44 AM
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] FTP using PHP in Zend Core still not working

We currently FTP files from "myAS400" to the Windows "QAServer" using
IBM's Toolbox for Java (i.e., JTOpen). Toolbox for Java FTP's files by
accessing the FTP server on "myAS400".

We run the Toolbox for Java FTP classes on the Windows "QAServer". The
Toolbox for Java FTP classes connect to "myAS400" with an iSeries
username and password. The Toolbox for Java FTP classes then transfer
files between "myAS400" the Windows "QAServer" using get and put
statements.

I was hoping to use PHP to access the FTP server on "myAS400" like
Toolbox for Java does. Should the PHP FTP classes work like the Toolbox
for Java FTP classes?

Thanks,
Kelly

-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx]
On Behalf Of Haas, Matt (CL Tech Sv)
Sent: Wednesday, July 15, 2009 9:21 AM
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] FTP using PHP in Zend Core still not working

I think I see why this is failing. You're using a file share on a
Windows server and that naming format doesn't work on OS/400. Also, it
seems like you should be connecting to the Windows server and you're
connecting to your AS/400.

Matt

-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx]
On Behalf Of Kelly Cookson
Sent: Wednesday, July 15, 2009 10:00 AM
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] FTP using PHP in Zend Core still not working

I will try pinging the Windows "QAServer".

The "myAS400" is the local server running the PHP scripts via Apache
(embedded in Zend Core). The scripts are running from the IFS on
"myAS400". Pinging myAS400 would be pinging the local machine.

Thanks for the suggestion.

Kelly

-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx]
On Behalf Of Haas, Matt (CL Tech Sv)
Sent: Wednesday, July 15, 2009 8:48 AM
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] FTP using PHP in Zend Core still not working

What happens when you ping "myAS400"? Do any of the logs on the system
show any error messages? My experience with PHP is pretty limited but
don't errors from it end up the Apache error log?

Matt

-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx]
On Behalf Of Kelly Cookson
Sent: Tuesday, July 14, 2009 11:15 PM
To: web400@xxxxxxxxxxxx
Subject: [WEB400] FTP using PHP in Zend Core still not working

I configured Zend Core to make the ftp functions available. That was
part of the problem. But I still can't get the FTP get and put
functions to work. We FTP between the QAServer and myAS400 server using
Toolbox for Java. So I know it can be done.

SCRIPT #1:
get RemoteFile [LocalFile]

<?php
$conn = ftp_connect("myAS400");
ftp_login($conn,"username","password");
ftp_raw($conn,"BINARY");
ftp_raw($conn,"QUOTE SITE NAMEFMT 1");
if
(ftp_get($conn,"\\\\QAServer\\MyDir\\QAServerFile.txt","/www/zendcore/ht
docs/kcookson/QAServerFile.txt",FTP_ASCII)) {
print ("<br />ftp get successful");
} else {
print ("<br />ftp get not successful");
}
$close = ftp_close($conn);
?>

When I run this script in Zend Core i5, I get the "ftp get not
successful" message.
Same negative result with or without the ftp_raw statements.

SCRIPT #2:
put LocalFile [RemoteFile]

<?php
$conn = ftp_connect("myAS400");
ftp_login($conn,"username","password");
ftp_raw($conn,"BINARY");
ftp_raw($conn,"QUOTE SITE NAMEFMT 1");
if
(ftp_put($conn,"/www/zendcore/htdocs/kcookson/AS400File.txt","\\\\QAServ
er\\myDir\\AS400File.txt",FTP_ASCII)) {
print ("<br />ftp put successful");
} else {
print ("<br />ftp put not successful");
}
$close = ftp_close($conn);
?>

When I run this script in Zend Core i5, I get the "ftp put not
successful" message.
Same negative result with or without the ftp_raw statements.

SCRIPT #3:
When I run this third script on my laptop in my Zend Studio debugger, it
WORKS. I get the "ftp get successful" message. It actually transfers the
file from the IFS on my AS400 to myDir on the QAServer Windows server.
But note that form of the statement is

get target [source]

which is opposite of the proper form. Why this works, I have no idea.
But I have repeated it several times.

<?php
$conn = ftp_connect("myAS400");
ftp_login($conn,"username","password");
ftp_raw($conn,"BINARY");
ftp_raw($conn,"QUOTE SITE NAMEFMT 1");
if
(ftp_get($conn,"\\\\QAServer\\myDir\\AS400File.txt","/www/zendcore/htdoc
s/kcookson/AS400File.txt",FTP_ASCII)) {
print ("<br />ftp get successful");
} else {
print ("<br />ftp get not successful");
}
$close = ftp_close($conn);
?>

When I run this same script in Zend Core i5, it fails. I get the "ftp
get not successful" message



Any ideas???



Thanks,

Kelly Cookson

Senior Programmer\Analyst

Dot Foods, Inc.

1-217-773-4486 ext 12676




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.