There is a way to list a directory in a remote host without ftp ?
A way using php will be better.
thanks.
No, you can't do that, unless you get some sort of shell access to the remote host, or the remote host provides you with an API to list it (remote API can be an API, or a FILE SERVER FILE SYSTEM access such as NFS or SAMBA).
Related
In PHP, I am accessing another user's files using FTP on the same server. In this case, do I need to use secure FTP or is it ok to have normal FTP as both source and destination are on same server?
Thanks.
It's possible to connect to a shared folder and list, read or write files in the folder as if it were a local folder with php? I was searching but I haven't found anything that woks for me.
If you intend to access Windows-based Share with SMB protocol, use can use Icewind\SMD library.
It can't possible with only PHP, We can't access the local directory/file using PHP.
But, If you write some Thread or File Watcher task using Java(Watch service) or Python or any other supported technology and send file related events to your PHP web-service or API.
Not sure but if will think in that way...it can be possible.
I have a game server running in a vps with centos 6 .
The game server stores its status data on a text file and i want to access this file from my website server with php.
The problem is that it is better to do it without installing something link ftp server on the vps. Also i do not know how to set the ftp account directory to my game server directory.
Anyone knows any other simpler way to do so ?
Thanks.
Use a client which supports SFTP if you are able to connect to your server via SSH.
phpseclib handles the SFTP connection without the need to install an extension. For an example on how to download a file with SFTP go here.
If you don't have a webserver installed on your vps, you can use an sftp connection with php, check this question to help you implement it.
sFTP being available by default on most linux OSs you shouldn't have much trouble doing this;
Is there any possbile solutions in PHP to create a file or directory on the client machine.
Note:
Downloading the file is not a solution to me. only once the user access the website and execute some function and it allows to create a files or directory on the client machine.
Simply, you can't do that in php or any other server side language.
Reason is simple server side application and scripts have access only to local resources where they are launched. So when you run your application on local computer, everything works as you wish for. But because of how HTTP works and because of safety reasons you cannot access user local files.
No it's not possible , except- Flash, Applet ( Not sure ), Microsoft Silverlight ! and for those you will also have to give permission. But i don't think it is a good idea to store file on client machine, try another :)
I'm trying to wrap my brain about how to do this. We need to provide some files within a directory from our servers to our clients' servers via a PHP/Web interface using FTP. I've looked at the FTP capabilities built in to PHP and some custom classes, but someone suggested cURL might be a better option. We will have the FTP login credentials in our database for the application to access. With that information can we use cURL FTP capabilities to do the transfers, knowing our server has libcurl installed, but the clients servers may not? Do both servers have to have it for the FTP function to work?
Or am I completely going about this the wrong way, and have misunderstood how to use cURL and should be looking into an FTP PHP class?
libCURL is a library; it acts as the client.
Your clients need to be running a FTP server but do not need libCURL.
Just to make it super clear, there are 2 computers involved:
Your server, the one that's supposed to provide files to the client using the FTP protocol. That server does not need to have a web server (or PHP) running. The only thing it needs is an FTP server. It also needs to have permissions configured in such a way that there is an account that can access the files through FTP.
Your client's server, the one that's supposed to retrieve files from your server using the FTP protocol. That server needs to have PHP installed, with libCurl. The software on that server needs to access your server using the FTP protocol, providing the user credentials that you configured on your box.
Hope that helps.
It sounds like what you want to do is have the client connect to your PHP script & then push a button to start an FTP transfer that sends a file from your FTP server to their FTP server. If this is the case, then all you need is cURL on your server.