![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Expert Programmer
Join Date: Dec 2004
Posts: 794
Rep Power: 4
![]() |
Wouldn't that be for a GET request Game_Ender?
By the way, it seems like people could easily abuse this and put whatever they wanted on the high-score list.
__________________
Few people deserve to be compared to (Rush) Limbaugh, most of them were convicted at the Nuremburg trials. --WilliamSChips on Slashdot |
|
|
|
|
|
#12 |
|
Professional Programmer
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3
![]() |
It could quite possibly be a GET request, I know you can do html forms through both a POST and a GET and I don't know the exact differences between the two. Html is not my strong suit so you are probably right. That is why I advised him to do some reading on html forms, I know where to point but not exactly what to say.
|
|
|
|
|
|
#13 |
|
Expert Programmer
|
You might want to look into JSP (Java Server Pages).
|
|
|
|
|
|
#14 | |
|
Hobbyist Programmer
Join Date: Feb 2006
Posts: 214
Rep Power: 0
![]() |
Quote:
The problem is getting a string "10294059" for instance, to the action.php program. Somehow by sending a string from the java applet to the URL. import java.awt.*;
import java.io.*;
import java.applet.*;
import java.net.*;
class SaveData extends Applet
{
public void init ()
{
String line;
URL url = null;
try
{
url = new URL ("http://m-net.arbornet.org/~eric/action.php");
}
catch (MalformedURLException e)
{
System.out.println ("Malformed URL ");
stop ();
}
}
}that red writting is the URL. So how do I send a string to this site?
__________________
Death smiles at us all. All a man can do is smile back. |
|
|
|
|
|
|
#15 |
|
Battle Programmer
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 748
Rep Power: 3
![]() |
I don't know how to make Java and PHP interact, but I can explain the GET vs. POST a little. These are the two methods through which forms are submitted (hence the method="get" or method="post" attribute).
GET parameters are simply appended to the url after a '?' and are separated by '&'. For instance, if a url was http://someplace.com/aPage.php?player=someone&score=10294059 POST variables don't show up in the URL. I'm actually not sure where they're sent, but it is more difficult to change them. Of course, they arrive to the PHP page in $_POST, too. Pages relying on POST variables cannot be bookmarked since you can't set the values by hand (or very easily at least - I think there's some browsers that'll allow a user to set POST variables). HTH |
|
|
|
|
|
#16 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
I'm curious as to why you are using Java (the game itself?). However, there are ways to interact between Java and Javascript. The Javascript could conduct the appropriate request, and there you go, Aunt Gertie's your uncle.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#17 |
|
Programmer
|
Am i the only one who is wondering who Aunt Gertie is and why she is my uncle?
She was refered to numerious times in your openBSD thread. I guess i must have missed something. lol.
__________________
Bite My Shiny Metal Ass |
|
|
|
|
|
#18 |
|
Expert Programmer
|
I think Aunt Gertie is meant to represent a standard computer user. I may be wrong.
![]()
__________________
Join us at #programmingforums @ irc.freenode.net! My software never has bugs. It just develops random features.
|
|
|
|
|
|
#19 |
|
Hobbyist Programmer
Join Date: Feb 2006
Posts: 214
Rep Power: 0
![]() |
the Java Applet is the game itself which takes care the game and sending info to a web page "action.php". Javascript isn't an option, unfortunately.
The method I would have to use is the "post" method. "Figure A.1" is the html page that would normaly send the score. However, instead of telling the user to "go to this website and enter your score", I want to do it for them. Thus, my java applet must do this. Interacting with the PHP program (on the server) shouldn't be a problem. All I have to do is basically send the score data to the site. You guys are telling me to send the info to the url. Well the url is similar to "http://m-net.arbornet.org/~eric/action.php" and I'm not sure exactly what I'm supposed to do with the url once I've formed it. So far, I use the url class to form the url with import java.applet.*;
import java.awt.*;
import java.io.*;
import java.net.*;
...
url = new URL ("http://m-net.arbornet.org/~eric/action.php");
// String score = 1012345";Any ideas? Figure A.1 <html> <body> <form action ="action.php" method="post"> <p>Your name: <input type="text" name="strname"/></p> <input type="submit"/> </body> </html>
__________________
Death smiles at us all. All a man can do is smile back. |
|
|
|
|
|
#20 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
The fact that Java is required (because of the game) doesn't mean you can't make a Javascript/Java object, access it from both sides, and use it strictly as a communication mechanism between the applet and the page. It's been over three years since I did this, but if you have the O'Reilly book on Javascript you'll find it covered to some extent there. I had a similar situation with a web casino. No way Javascript could produce things like a slot machine's spinning wheels in sufficient time (although it was fine for keno).
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|