Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #6633 > unrolled thread

Using PHP and JAVA applets together

Started by"K.J.Williams" <lord_kjwilliams@yahoo.com>
First post2012-07-20 20:09 -0700
Last post2012-07-23 10:46 +0000
Articles 5 — 5 participants

Back to article view | Back to comp.lang.php


Contents

  Using PHP and JAVA applets together "K.J.Williams" <lord_kjwilliams@yahoo.com> - 2012-07-20 20:09 -0700
    Re: Using PHP and JAVA applets together Michael Vilain <vilain@NOspamcop.net> - 2012-07-21 00:29 -0700
    Re: Using PHP and JAVA applets together "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-07-23 08:36 +0200
    Re: Using PHP and JAVA applets together Erwin Moller <erwinmollerusenet@xs4all.nl> - 2012-07-23 12:08 +0200
    Re: Using PHP and JAVA applets together Denis McMahon <denismfmcmahon@gmail.com> - 2012-07-23 10:46 +0000

#6633 — Using PHP and JAVA applets together

From"K.J.Williams" <lord_kjwilliams@yahoo.com>
Date2012-07-20 20:09 -0700
SubjectUsing PHP and JAVA applets together
Message-ID<a16b5256-638a-4b9d-a6d7-045347ff081c@googlegroups.com>
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

[toc] | [next] | [standalone]


#6634

FromMichael Vilain <vilain@NOspamcop.net>
Date2012-07-21 00:29 -0700
Message-ID<vilain-DC968D.00291121072012@news.individual.net>
In reply to#6633
In article <a16b5256-638a-4b9d-a6d7-045347ff081c@googlegroups.com>,
 "K.J.Williams" <lord_kjwilliams@yahoo.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]

[toc] | [prev] | [next] | [standalone]


#6640

From"Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid>
Date2012-07-23 08:36 +0200
Message-ID<juirch$rre$1@dont-email.me>
In reply to#6633
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
--

[toc] | [prev] | [next] | [standalone]


#6641

FromErwin Moller <erwinmollerusenet@xs4all.nl>
Date2012-07-23 12:08 +0200
Message-ID<500d22a2$0$6988$e4fe514c@news2.news.xs4all.nl>
In reply to#6633
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

[toc] | [prev] | [next] | [standalone]


#6642

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2012-07-23 10:46 +0000
Message-ID<juja2h$ar3$1@dont-email.me>
In reply to#6633
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web