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.
Related
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 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.
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.
I have a database that exports xmls only locally (to my computer). It will not export to a remote server.
I have a php file (located on remote server) that sends the xml to a webserivce.
Can I have the remote php file use "file_get_contents" function to extract xml data from my local computer?
If so, what is the proper syntax?
Thanks in advance.
I think you should add a file upload page,upload the local xml file to remote server,the do the the next work.
You have a couple of options...
You could run a local web server on your computer and publish the files via that. Your remote PHP script could then read the file.
A potentially better alternative would be to use something like Dropbox. Save the database files in your Dropbox folder. They will be automatically uploaded to the Dropbox cloud storage.
Your remote PHP script could then retrieve them via the Dropbox API or if they are in the "public" folder, directly via URL.
You have to make your file available from your linux machine:
install a webserver on your desktop machine and allow it to expose the file, so the file will be available to an URI like http://ip_of_your_desktop/path_to_files/filename.xml (this was mentioned above also)
if your desktop and server are on the same network, share the folder on your desktop, mount the folder on your linux machine and use file_get_contens to read the file from the mounted location