How to use fopen("ftp://....) with the VMS

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sambavan
Forum Newbie
Posts: 2
Joined: Mon Oct 21, 2002 4:17 pm

How to use fopen("ftp://....) with the VMS

Post by sambavan »

Hi Folks,

I'm in deed to ftp some file periodically to one of our vms server and now stuck on not knowing how to specify the directory path on the fopen.

I tried

Code: Select all

fopen("ftp://username:password@servernameDIRNAME");
The place I stuck with is at not knowing how to specify the directory name of the vms server. As those who have worked on the VMS server know the dirctory naming comes like DISK$1:[logingname]

Could some one help me on how to do this ?

I tried the following

Code: Select all

fopen("ftp://username:password@servernameDISK\$1:їlogingname]file_name");
    
      fopen("ftp://username:password@servername\$DISK\$1:їloginname]file_name");

      fopen("ftp://username:password@servername\\DISK\$1:їloginname]file_name");
All of the above failed!

Any help would greatly be appreciated!

Thanx,
Sam
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

try

Code: Select all

fopen('ftp://username:password@servername/DIRNAME', $mode);
also note http://www.php.net/manual/en/wrappers.f ... ote]Allows read access to existing files and creation of new files via FTP. If the server does not support passive mode ftp, the connection will fail.[/quote]

but php offers ftp-functions. read XXXIII. FTP functions
sambavan
Forum Newbie
Posts: 2
Joined: Mon Oct 21, 2002 4:17 pm

Post by sambavan »

Volka,

I agree to your point. The issue I'm facing here is when ceratin query was performed against the database, it had to upload the output to the remote server. So I used a buffer to store it and then write it to the remote server.

The code I mentioned has a small mistake, where I had forgot to mention the mode. It will be of write mode

Code: Select all

i.e 
      fopen('ftp://username:password@servername/DIRNAME', 'w');
The problem I was facing on this was the part of FTPing to VMS server. The filenaming and directory naming on VMS is different from Unix or Windows. In VMS I believe that that there is no concept of / on your file naming structure. As a result when I do the following

Code: Select all

fopen('ftp://username:password@servername/DISK\$15:їxxxxx].filename','w')
When I get to do the following, the VMS server is creating a long file name with all the directory path in it. So, as you can see, I want only the file name to get created and not the name that would be with the long set of junks.

Do you have any idea on how to go about with this?

Sam
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

strange, FTP should behave like on any other system.
You can test it with a regular ftp client.
Post Reply