Writing to a website
Hello, I've been searching around but I couldn't find any way to take write a string to a text file on my website, here is an example if you don't understand.
I take input from the user, we'll use a "bug report" for this example.
In my source code I handle the bug report and send it to the website.
(I'm not sure what I'd do after this.) The website handles the input and appends it to a text file.
What I need to know:
1) How to send a String to a website.
2) What the website will have to do to append it to the text file.
Results: Me being able to open the text file and view the information.
I'll greatly appreciate any help you may be able to provide.
I apologize for the double post but I have this problem half solved.
On my end I have a php script that reads from the url, EX:
and in the script:
$Name would equal "hello" in this case.
I then use that input.
So on the server end I need to:
1) Form the URL (Something like: String url = "mysite.com/script.php?o=" + String1";)
2) Get the script to execute via connecting to the url.(I have no idea how.)
I hope I explained it clearly enough.
I'm sorry, but I'm trying to see what place Java has in this scenario. Please explain?
Sorry for the slow reply, I'll try to clarify:
A PHP script takes input from the url, EX: site.com/phpscript.php?name=hello
Java forms the url, EX:
String url = "site.com/phpscript?name=hello";
and uses it the same way a web browser would, therefore executing the PHP script. (That is what I need to know how to do.)
I hope this clarifies it.
Do you have the source code of the php script?
It works fine if I go to the url in my web browser, I just need to know how to get Java to do it.
if($NAME != null)
$Handle=fopen($File,'a') or die("Couldn't find log file.");
You could make the same but in java, so you don't need to use the website.
Btw, I don't think your php script is "hacker" proof.
You should always check POST's and GET's.