Connecting Tech Pros Worldwide Help | Site Map

Sending data to a Java Applet

  #1  
Old July 17th, 2005, 05:18 AM
James
Guest
 
Posts: n/a
I am trying to set up a PHP file that receives data from an applet via
Java's URL object (this sends a URL so I can place PHP attributes in this),
gets a set of numbers from a database table and sends them back to the
applet.

The part I am unsure of is how to send data back to applet. The applet will
be able to read information back in but I can't find any information on how
to send information out from a PHP file. Obviously there is 'echo' but I am
not sure if it can be used in this situation.

Here is an example of the DB table to clarify the type of data being output
by the PHP script:

Table data:

name data(of type number)
donnie 3
donnie 1
frank 2
donnie 4

and I will simply extract data with an SQL statement such as SELECT * FROM
data where name = 'donnie';

Any help or advice or topics I should be researching would be great.


  #2  
Old July 17th, 2005, 05:19 AM
Andy Hassall
Guest
 
Posts: n/a

re: Sending data to a Java Applet


On Fri, 19 Mar 2004 13:17:32 +0000 (UTC), "James" <nospamheredude@yahoo.com>
wrote:
[color=blue]
>I am trying to set up a PHP file that receives data from an applet via
>Java's URL object (this sends a URL so I can place PHP attributes in this),
>gets a set of numbers from a database table and sends them back to the
>applet.
>
>The part I am unsure of is how to send data back to applet. The applet will
>be able to read information back in but I can't find any information on how
>to send information out from a PHP file. Obviously there is 'echo' but I am
>not sure if it can be used in this situation.[/color]

I think that's exactly what you want, if I'm understanding your requirements.
[color=blue]
>Here is an example of the DB table to clarify the type of data being output
>by the PHP script:
>
>Table data:
>
>name data(of type number)
>donnie 3
>donnie 1
>frank 2
>donnie 4
>
>and I will simply extract data with an SQL statement such as SELECT * FROM
>data where name = 'donnie';[/color]

Just echo out the information from PHP in whatever format the Java applet
wants. Then in Java use java.net.URL.openStream to get an InputStream, and read
and parse the data.

--
Andy Hassall <andy@andyh.co.uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sockets class question - sending TCP data D. Patrick answers 7 June 27th, 2006 12:05 PM
send data to all users using same web application? Rich answers 2 February 6th, 2006 06:25 AM
communication between applet in user machine with application in server ^CeFoS^ answers 3 July 17th, 2005 11:21 PM
Trying to marry php, java, and mysql apchar answers 5 July 17th, 2005 04:42 AM