Results 1 to 7 of 7
Thread: Writing to a website
- 03-18-2009, 03:00 PM #1
Member
- Join Date
- Mar 2009
- Posts
- 4
- Rep Power
- 0
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.
-Sean.
- 03-19-2009, 03:17 AM #2
Member
- Join Date
- Mar 2009
- Posts
- 4
- Rep Power
- 0
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:
Url: mywebsite.com/myphp.php?o=hello
and in the script:
$Name=_get['o'];
$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?
- 03-19-2009, 07:18 PM #4
Member
- Join Date
- Mar 2009
- Posts
- 4
- Rep Power
- 0
Sorry for the slow reply, I'll try to clarify:
Webserver side:
A PHP script takes input from the url, EX: site.com/phpscript.php?name=hello
Java side:
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.
- 03-19-2009, 07:25 PM #5
Member
- Join Date
- Mar 2009
- Posts
- 81
- Rep Power
- 0
Do you have the source code of the php script?
- 03-19-2009, 07:48 PM #6
Member
- Join Date
- Mar 2009
- Posts
- 4
- Rep Power
- 0
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.PHP Code:<?php $NAME=$_GET['name']; if($NAME != null) { $File="info.txt"; $Handle=fopen($File,'a') or die("Couldn't find log file."); fwrite($Handle,"-------------"); fwrite($Handle,chr(13)); fwrite($Handle,$NAME); fclose($Handle); } else { echo("Error."); } ?>
- 03-20-2009, 12:32 PM #7
Member
- Join Date
- Mar 2009
- Posts
- 81
- Rep Power
- 0
Similar Threads
-
programming website?
By ragarwal in forum Forum LobbyReplies: 11Last Post: 12-21-2009, 12:37 PM -
website section feedback
By MuslimCoder in forum Reviews / AdvertisingReplies: 0Last Post: 02-25-2009, 07:35 PM -
WebSite Update!
By Xyle in forum Reviews / AdvertisingReplies: 1Last Post: 02-16-2009, 08:47 AM -
How to download website (Get all link in website)
By finalmem in forum Advanced JavaReplies: 0Last Post: 11-12-2008, 08:43 AM -
Getting character set from a website
By Java Tip in forum Java TipReplies: 0Last Post: 11-26-2007, 12:53 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks