1

Possible Duplicate:
How to send HTTP request in java?

I have Java code running in an applet and I want to send the high score by a click of a button back to the PHP where it can be manipulated based on some conditions held within a database.

How do I go about this?

Community
  • 1
  • 1
longlost10
  • 59
  • 1
  • 9

2 Answers2

1

Use java.net.URL class to GET or POST data to an url. Any applet running should be able to do it. Implement your PHP to listen in this request.

URL could look like http(s)://<IP>:<PORT>/<CONTEXT>?myvar=<myvalue>

Chris
  • 5,346
  • 7
  • 35
  • 56
1

You have a number of choices:
1) Use Apache HTTPClient
2) Use URLConnection
See the answers to the questions:
1) Connection to a URL from within an applet using Apache's HttpClient vs using the JDK's URLConnection
2)How to use java.net.URLConnection to fire and handle HTTP requests

Community
  • 1
  • 1
munyengm
  • 13,831
  • 4
  • 21
  • 33