FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Using PHP and JAVA applets together
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Using PHP and JAVA applets together [message #178706] Sat, 21 July 2012 03:09 Go to next message
K.J.Williams is currently offline  K.J.Williams
Messages: 1
Registered: July 2012
Karma: 0
Junior Member
I wanted to know if you can design a method for a JAVA applet to send data to
a PHP server and vice versa (PHP server sends data to the JAVA applet) on the internet, so that either program does something different based on what the data is?

Thanks
Re: Using PHP and JAVA applets together [message #178707 is a reply to message #178706] Sat, 21 July 2012 07:29 Go to previous messageGo to next message
Michael Vilain is currently offline  Michael Vilain
Messages: 88
Registered: September 2010
Karma: 0
Member
In article <a16b5256-638a-4b9d-a6d7-045347ff081c(at)googlegroups(dot)com>,
"K.J.Williams" <lord_kjwilliams(at)yahoo(dot)com> wrote:

> I wanted to know if you can design a method for a JAVA applet to send data to
> a PHP server and vice versa (PHP server sends data to the JAVA applet) on the
> internet, so that either program does something different based on what the
> data is?
>
> Thanks

Not really helpful, but you really can design any sort of Java or php
program to do anything you want. The question is why? Is there some
application you don't have access to that's written in Java.

Web-based applications have two ways to send data to each other--GET
with arguments and POST with embedded arguments.

If you have some separate client/server thing going, then it's an
interprocess communications thing over a network socket. Use whatever
way to code that you know how. Php has socket functions as I'm sure
Java does. You just need to come up with a protocol and design that.

--
DeeDee, don't press that button! DeeDee! NO! Dee...
[I filter all Goggle Groups posts, so any reply may be automatically ignored]
Re: Using PHP and JAVA applets together [message #178713 is a reply to message #178706] Mon, 23 July 2012 06:36 Go to previous messageGo to next message
alvaro.NOSPAMTHANX is currently offline  alvaro.NOSPAMTHANX
Messages: 277
Registered: September 2010
Karma: 0
Senior Member
El 21/07/2012 5:09, K.J.Williams escribió/wrote:
> I wanted to know if you can design a method for a JAVA applet to send
> data to a PHP server and vice versa (PHP server sends data to the
> JAVA applet) on the internet, so that either program does something
> different based on what the data is?

Not sure of what you mean with "together", given that Java applets run
on top of a browser and PHP scripts typically run on top of a web server
(never a browser) but short answer is "yes, you can". But it's important
to understand that the way HTTP is designed makes it impossible to
*start* a connection from the server. If you need to communicate with
the browser, you must start the connection from Java.


--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
Re: Using PHP and JAVA applets together [message #178714 is a reply to message #178706] Mon, 23 July 2012 10:08 Go to previous messageGo to next message
Erwin Moller is currently offline  Erwin Moller
Messages: 228
Registered: September 2010
Karma: 0
Senior Member
On 7/21/2012 5:09 AM, K.J.Williams wrote:
> I wanted to know if you can design a method for a JAVA applet to send data to
> a PHP server and vice versa (PHP server sends data to the JAVA applet) on the internet, so that either program does something different based on what the data is?
>
> Thanks
>

Your question is framed in such a way that I get the impression you are
not sure what (Java applet/PHP) runs where.
"so that either program does something different based on what the data
is" <-- that is vague.

To clarify:

An applet runs in the browser (client).
An applet can request ANY data from ANY server. If you use the same
domain where the applet is hosted, things will be easier to set up for you.
So if your applet is hosted here:
http://www.example.com/yourpage.php
and the HTML coming from there embeds an applet, that applet can easily
reach to www.example.com, but not to www.anotherexample.com.
It needs additional rights for that (possibly this includes 'signing'
the applet.)
Ask in a java newsgroup for details. It has been years ago since I
programmed Applet <--> PHP communication, so better ask the experts.

And PHP ALWAYS runs on the server. It will never run at the client
(browser). PHP produces the HTML (or images, or whatever) that is sent
to the browser.
So as far as the browser is concerned, it could all be static HTML as well.

Hope this helps you approaching your puzzle. :-)

Regards,
Erwin Moller

--
"That which can be asserted without evidence, can be dismissed without
evidence."
-- Christopher Hitchens
Re: Using PHP and JAVA applets together [message #178715 is a reply to message #178706] Mon, 23 July 2012 10:46 Go to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On Fri, 20 Jul 2012 20:09:57 -0700, K.J.Williams wrote:

> I wanted to know if you can design a method for a JAVA applet to send
> data to a PHP server and vice versa (PHP server sends data to the JAVA
> applet) on the internet, so that either program does something different
> based on what the data is?

A php process on a server will process whatever requests are passed to it.

You will need to make the java applet send suitable requests (probably
using http get or post protocols), design your php process to process
those requests and return relevant data, and then have your java applet
process the responses and do stuff accordingly.

You might want to make the content of your responses some form of xml,
json, plain text, or some serialised or ascii encoded data format, rather
than a web page. This might involve using php functions to ensure that
the web server under which the php process is operating sends the data
with the right http protocol headers.

Rgds

Denis McMahon
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Errors Related to Same Path Through Real and Symbolic Link References
Next Topic: Draw some simple rectangles?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 10 12:52:43 GMT 2024

Total time taken to generate the page: 0.02476 seconds