In PHP, i know only how to get the files.
But now i don't know how to do with followings:
How can i distribute/ send/ transfer the files onto another owned Server?
Just to send from the host server. NOT the way to get from the target server.
Please suggest if you know.
Use curl, it support POST http method (if you receive file from html form), and ftp methods (if you had setup ftp server).
If the other servers is yours, you can install a FTP server and use the ftp functions:
http://es2.php.net/ftp
http://es2.php.net/manual/es/function.ftp-fput.php
You can use the curl_XXX functions for this.
How will you recieve the file?
If you have a webserver listening for POST requests, I would recommend cURL.
If you're running some other sort of server I would recommend sending it via sockets.
Yep, you can either install an FTP server on the servers you want to send the data to and then use PHP's FTP functions or use curl, and have a script running on the server you want to send the data to to pick up POST data coming in from the server you're sending the data from.
Hey use php ftp function to transfer files on to the another server.
But make sure that, server given you write permission to edit.
You can go through ftp_fput() method of php to transfer files on
remote server. Go through php manual you will get ready examples for
sending files.
Firstly use ftp_connect() function to connect to remote server.
Then read files from your local directory using file functions and then use fput to put file on to the remote server.
Related
I have a client database that generates and stores reports on a local server and I would like these reports to be able to be accessed by a publicly accessible remote server.
The local server runs windows, and I am running a unix installation on the remote server.
The public side is built with codeigniter, and the local side is proprietary php code. How would I go about transferring files onto the remote server?
I am not looking for somebody to write the code for me, but if you could provide a general example, or point me in the right directon it would be greatly appreciated.
You can use CURL to send file in background to local server to other server, Here is good example.
How to send upload file to other website by using curl in php?
I ended up installing winSCP on my local windows server, then from the php file using shell_exec to call a batch file with commands to transfer the file.
When someone comes to my website via url: http://domain.com/FILE_ID, PHP would connect to the ftp server and get FILE_ID and then stream it to client without saving it on the local server. I don't want to provide my clients with a link to my file on ftp server instead I thought of this.
Does anyone have an idea how I can accomplish this?
I was thinking I could use "ftp_get()" method to get the file from ftp but that requires me to write in on a local server(or am I wrong?). After that use PHP headers to force the download.
Basically any and every piece of information would be useful. Just so I can start walking in the right direction.
What you are after is the Curl library - as it can handle FTP. See this, it has an FTP example.
Alternatively, if you've got a server that has URL bindings for file_get_contents, you can use
file_get_contents("ftp://username:password#server/path/to/file.ext");
to get the contents of a remote file on an FTP server.
I used to transfer temporarily-direct-linked files to my server because my internet speed is not as much as my server. The method I'm using (fread) only works with http protocol. But I can not even get connected to files accessible using RTMP protocol using fopen. Could you tell me what can I do to get around this?
Cheers
You might be able to use curl - this can be compiled with librtmp support. Not sure if it's supported within the PHP curl extension, but you could simply use curl as a separate process.
I am working on a Flash file where I need to POST data from my local swf to a PHP file on my live server.
I use code from following url:
http://tush.wordpress.com/2007/07/20/actionscript-3-using-urlloader-to-send-and-load-server-variables/
The remote PHP file is getting called but I could not get data in POST, neither in GET method. Seems like data is not getting POSTed to my remote PHP file from the local swf.
Please guide.
thanks
If you can POST to a local file, then you should check if your server is open to do these sorts of things. (Either check the Apache config or PHP config).
You might also want to check Security.allowDomain("your url"); which is in flash.system.Security;
The answer is that you can't do it.
You can't cross domains like this. If you're running your SWF locally, you can only ever talk to local resources. If you're running it from a server, you can talk to other network resources through the use of cross-domain policy.
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.