How to interact with STDIN/STDOUT?
Posted: Thu Nov 20, 2008 5:13 pm
I am attempting to connect to a host via webdav. Other protocols such as FTP are not an option. I don't have the option of building in any optional/third-party wrappers, such as PHP WebDAV. However, the system I am connecting from does have cadaver.
From the shell, I interact with cadaver as follows:
How, from within a php script, do I interact with the shell or STDIN/STDOUT in this post-response manner? I wish to invoke cadaver via something like the following pseudo-code:
Thanks in advance
From the shell, I interact with cadaver as follows:
My question:$> cadaver somehost.com
Authentication required for Documents access on server `somehost.com':
Username: <username>
Password:
dav:/fileserver/client/> quit
Connection to `somehost.com' closed.
How, from within a php script, do I interact with the shell or STDIN/STDOUT in this post-response manner? I wish to invoke cadaver via something like the following pseudo-code:
Code: Select all
// open stream
$resource = shell_exec to open connection stream with cadaver;
// push username to stream;
put($resource, 'username');
// push password to stream;
put($resource, 'password');
// if successful push standard cadaver commands to stream
get($resource, 'some_file.txt');