简体   繁体   中英

communicate with server to edit a file

I want to have a program that is run in console communicate with a server. I have the url of my website which I can access through ssh but I want this program to be able to work without logging in so that I could give the program to other people without having any security concerns. In particular I'd like this program to be able to write to a file that is on the server. I was considering using form filling but this doesn't seem to work.

Here is a specific example of the kind of thing I want to do. The server has a file on it called count.txt that contains the number 0. The program when run communicates with the server is some manner so that the text file on the server has the number incremented by 1. So if I were to run the program 10 times it would have the number 10 in the file.

Here is another example, I run the program in console like this:
./myprogram Word
which would case Word to be written to the file

When this is done I want to be able to do ./myProgram in my console and have this happen. I shouldn't have to be logged into the server.

Any links to explanations of how to do this would be great. Thanks

To elaborate on what nnnnnn is saying you would send your http request as

    http://yoursite.com/update.php?key=value

In your update.php application you would extract that value using

    $_GET['key'];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM