how to create a text file in remote server from local system with full path of that file.

I created a text file in my system.

$fp = fopen( http:://192.168.192.168/icronex/text.txt ,w+)
fwrite($fp,"icronex is my name");
fclose($fp);

But i got an error like can't find file in this directory...........

but i need to create a text file on remote system like

Plese send me the fully code of this.

Regards
icronex

    You can't write to a remote server. If you could, you could just write a file called index.html on someone else's server and wipe out their web site.

    You have two options:

    1. Write a PHP script on the remote server. Use your local server to connect to that remote script, pass in some data, and the script on the remote server writes to a local file.

    2. Use the FTP commands in PHP. Write a file on the local server and then use the FTP commands to transfer that file to the remote server. Of course, you'll need the username and password for an account on the remote server to make the FTP commands work... and that's there to prevent people from putting files there without permission.

      Depending upon the server, you may also have the PUT option available to you.

      If the remote webserver supports (and allows) PUT operations, you can either manually [man]fopen/man a connection and output the headers & data or use the [man]cURL[/man] library which claims to support PUT as well (I say "claims to" because I haven't ever done it myself and didn't search the documentation for instructions).

        Write a Reply...