[PHP] Using PHP with JAVA
I have been searching the web for ways to execute remote PHP files through the use of JAVA code, but I haven't had any luck. I have found many ways to call JAVA functions from a PHP script, but not the other way around. What I'm trying to accomplish is I want to build a JAVA application that will be run from a users local computer after installation and this JAVA program will connect to a url on my server (a url to a PHP script). This PHP script will be used to connect to the server's MySQL database and send some retrieved information back to the JAVA application on the users machine. I have been searching the web for hours trying to find a tutorial, or advice on how to accomplish this, but so far I have had no luck. If anyone has any advice or suggestions please let me know. Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Using PHP with JAVA
For this you will want to use a standard socket to port 80 with GET yourscript.php?var=foo HTTP/1.0\r\n\r\n in the send method and the recieve method will return the results. They have higher level APIs for HTTP but this is my preference. You should easily be able to find examples on using sockets in Java. Regards. -Gregory -Original Message- From: Matt Palermo [mailto:[EMAIL PROTECTED] Sent: Friday, October 24, 2003 10:11 AM To: [EMAIL PROTECTED] Subject: [PHP] Using PHP with JAVA I have been searching the web for ways to execute remote PHP files through the use of JAVA code, but I haven't had any luck. I have found many ways to call JAVA functions from a PHP script, but not the other way around. What I'm trying to accomplish is I want to build a JAVA application that will be run from a users local computer after installation and this JAVA program will connect to a url on my server (a url to a PHP script). This PHP script will be used to connect to the server's MySQL database and send some retrieved information back to the JAVA application on the users machine. I have been searching the web for hours trying to find a tutorial, or advice on how to accomplish this, but so far I have had no luck. If anyone has any advice or suggestions please let me know. Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using PHP with JAVA
You have various options and it depends on how you want to accomplish it and what you are familiar with. Java has many capabilities of doing network io (class HttpUrlConnect). You can contact your php page on your server and pull down the information (similar to what a browser does). Another alternative is to have php run as soap and have your java access the php soap service and get xml data. Then you java app can parse the xml and then display it to the user. HTH... -- Ray On Fri, 2003-10-24 at 08:10, Matt Palermo wrote: I have been searching the web for ways to execute remote PHP files through the use of JAVA code, but I haven't had any luck. I have found many ways to call JAVA functions from a PHP script, but not the other way around. What I'm trying to accomplish is I want to build a JAVA application that will be run from a users local computer after installation and this JAVA program will connect to a url on my server (a url to a PHP script). This PHP script will be used to connect to the server's MySQL database and send some retrieved information back to the JAVA application on the users machine. I have been searching the web for hours trying to find a tutorial, or advice on how to accomplish this, but so far I have had no luck. If anyone has any advice or suggestions please let me know. Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using PHP with JAVA
Sorry, i forgot to mention the package that you might really want to review... java.net is the java package that provides all these classes, like URLConnection and Sockets as mentioned by another person. -- Ray On Fri, 2003-10-24 at 08:24, Ray Hunter wrote: You have various options and it depends on how you want to accomplish it and what you are familiar with. Java has many capabilities of doing network io (class HttpUrlConnect). You can contact your php page on your server and pull down the information (similar to what a browser does). Another alternative is to have php run as soap and have your java access the php soap service and get xml data. Then you java app can parse the xml and then display it to the user. HTH... -- Ray On Fri, 2003-10-24 at 08:10, Matt Palermo wrote: I have been searching the web for ways to execute remote PHP files through the use of JAVA code, but I haven't had any luck. I have found many ways to call JAVA functions from a PHP script, but not the other way around. What I'm trying to accomplish is I want to build a JAVA application that will be run from a users local computer after installation and this JAVA program will connect to a url on my server (a url to a PHP script). This PHP script will be used to connect to the server's MySQL database and send some retrieved information back to the JAVA application on the users machine. I have been searching the web for hours trying to find a tutorial, or advice on how to accomplish this, but so far I have had no luck. If anyone has any advice or suggestions please let me know. Thanks, Matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using PHP with JAVA
Hi, For this scenario, Ray's suggestion of SOAP is IMHO the best option. But just out of curiosity why do you want to mix the two languages? If you are familiar with java you might be better off doing your server side stuff using J2EE. Then you might be able to use Object Streams for your communications or RMI. Then there is the XMLEncoder class that was made availble with 1.4 better stop before someone shoots me down this is a PHP list after all :-) Matt Palermo wrote: I have been searching the web for ways to execute remote PHP files through the use of JAVA code, but I haven't had any luck. I have found many ways to call JAVA functions from a PHP script, but not the other way around. What I'm trying to accomplish is I want to build a JAVA application that will be run from a users local computer after installation and this JAVA program will connect to a url on my server (a url to a PHP script). This PHP script will be used to connect to the server's MySQL database and send some retrieved information back to the JAVA application on the users machine. I have been searching the web for hours trying to find a tutorial, or advice on how to accomplish this, but so far I have had no luck. If anyone has any advice or suggestions please let me know. Thanks, Matt -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha/megaupload/ Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using PHP with JAVA
I don't neccessarily WANT to mix the 2 languages. I just have an application on my webserver that uses MySQL databases and the script is all written in PHP (which I am pretty good at). The only reason I want to use JAVA is so a user can download and install a program that I write (since JAVA is platform independant) that they can run on their local computers. This JAVA program will connect to the server (PHP files) and send back all the information to the JAVA app. This way, the user doesn't even have to go to the website for this script. They can just open the JAVA program and it will be passed all the neccessary information. I'm just a beginner in JAVA, so it will probably take me quite a while to figure out how to build a whole program like this. Eventually, I want it to be similar to the Gallery Remote program (found at: http://gallery.menalto.com/) for a PHP image gallery. I got a long way to go before I will have this created though, since I'm very new to JAVA (I'm much stronger in PHP). Anyway, I'm sure you get the idea. Matt Raditha Dissanayake [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, For this scenario, Ray's suggestion of SOAP is IMHO the best option. But just out of curiosity why do you want to mix the two languages? If you are familiar with java you might be better off doing your server side stuff using J2EE. Then you might be able to use Object Streams for your communications or RMI. Then there is the XMLEncoder class that was made availble with 1.4 better stop before someone shoots me down this is a PHP list after all :-) Matt Palermo wrote: I have been searching the web for ways to execute remote PHP files through the use of JAVA code, but I haven't had any luck. I have found many ways to call JAVA functions from a PHP script, but not the other way around. What I'm trying to accomplish is I want to build a JAVA application that will be run from a users local computer after installation and this JAVA program will connect to a url on my server (a url to a PHP script). This PHP script will be used to connect to the server's MySQL database and send some retrieved information back to the JAVA application on the users machine. I have been searching the web for hours trying to find a tutorial, or advice on how to accomplish this, but so far I have had no luck. If anyone has any advice or suggestions please let me know. Thanks, Matt -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha/megaupload/ Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using PHP with JAVA
hi, Great to hear that PHP is your language of choice. There are several SOAP libraries available and they come with good docs. However if you are building an image gallery type application, you will be able to do mos of the work just by using java.net package has has been pointed out. all the best Matt Palermo wrote: I don't neccessarily WANT to mix the 2 languages. I just have an application on my webserver that uses MySQL databases and the script is all written in PHP (which I am pretty good at). The only reason I want to use JAVA is so a user can download and install a program that I write (since JAVA is platform independant) that they can run on their local computers. This JAVA program will connect to the server (PHP files) and send back all the information to the JAVA app. This way, the user doesn't even have to go to the website for this script. They can just open the JAVA program and it will be passed all the neccessary information. I'm just a beginner in JAVA, so it will probably take me quite a while to figure out how to build a whole program like this. Eventually, I want it to be similar to the Gallery Remote program (found at: http://gallery.menalto.com/) for a PHP image gallery. I got a long way to go before I will have this created though, since I'm very new to JAVA (I'm much stronger in PHP). Anyway, I'm sure you get the idea. Matt Raditha Dissanayake [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, For this scenario, Ray's suggestion of SOAP is IMHO the best option. But just out of curiosity why do you want to mix the two languages? If you are familiar with java you might be better off doing your server side stuff using J2EE. Then you might be able to use Object Streams for your communications or RMI. Then there is the XMLEncoder class that was made availble with 1.4 better stop before someone shoots me down this is a PHP list after all :-) Matt Palermo wrote: I have been searching the web for ways to execute remote PHP files through the use of JAVA code, but I haven't had any luck. I have found many ways to call JAVA functions from a PHP script, but not the other way around. What I'm trying to accomplish is I want to build a JAVA application that will be run from a users local computer after installation and this JAVA program will connect to a url on my server (a url to a PHP script). This PHP script will be used to connect to the server's MySQL database and send some retrieved information back to the JAVA application on the users machine. I have been searching the web for hours trying to find a tutorial, or advice on how to accomplish this, but so far I have had no luck. If anyone has any advice or suggestions please let me know. Thanks, Matt -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha/megaupload/ Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha/megaupload/ Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using PHP with JAVA
Also, I would like to point out that you could possibly use php-gtk to do some gui applications. Since it has a windows and *nix port you can use that too. I have built a couple of apps with it that pull snmp data from routers with it that worked great. I also used a java installer to install the required files. Might be worth looking into since it is php based. -- Ray On Fri, 2003-10-24 at 12:20, Raditha Dissanayake wrote: hi, Great to hear that PHP is your language of choice. There are several SOAP libraries available and they come with good docs. However if you are building an image gallery type application, you will be able to do mos of the work just by using java.net package has has been pointed out. all the best Matt Palermo wrote: I don't neccessarily WANT to mix the 2 languages. I just have an application on my webserver that uses MySQL databases and the script is all written in PHP (which I am pretty good at). The only reason I want to use JAVA is so a user can download and install a program that I write (since JAVA is platform independant) that they can run on their local computers. This JAVA program will connect to the server (PHP files) and send back all the information to the JAVA app. This way, the user doesn't even have to go to the website for this script. They can just open the JAVA program and it will be passed all the neccessary information. I'm just a beginner in JAVA, so it will probably take me quite a while to figure out how to build a whole program like this. Eventually, I want it to be similar to the Gallery Remote program (found at: http://gallery.menalto.com/) for a PHP image gallery. I got a long way to go before I will have this created though, since I'm very new to JAVA (I'm much stronger in PHP). Anyway, I'm sure you get the idea. Matt Raditha Dissanayake [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, For this scenario, Ray's suggestion of SOAP is IMHO the best option. But just out of curiosity why do you want to mix the two languages? If you are familiar with java you might be better off doing your server side stuff using J2EE. Then you might be able to use Object Streams for your communications or RMI. Then there is the XMLEncoder class that was made availble with 1.4 better stop before someone shoots me down this is a PHP list after all :-) Matt Palermo wrote: I have been searching the web for ways to execute remote PHP files through the use of JAVA code, but I haven't had any luck. I have found many ways to call JAVA functions from a PHP script, but not the other way around. What I'm trying to accomplish is I want to build a JAVA application that will be run from a users local computer after installation and this JAVA program will connect to a url on my server (a url to a PHP script). This PHP script will be used to connect to the server's MySQL database and send some retrieved information back to the JAVA application on the users machine. I have been searching the web for hours trying to find a tutorial, or advice on how to accomplish this, but so far I have had no luck. If anyone has any advice or suggestions please let me know. Thanks, Matt -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha/megaupload/ Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha/megaupload/ Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using PHP with JAVA
I don't know much about that, but it definitely sounds better, escpecially since it's still PHP based. Do you know of any websites or tutorials I can go to to learn more about it? It sounds like a much better option. Thanks, Matt Ray Hunter [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Also, I would like to point out that you could possibly use php-gtk to do some gui applications. Since it has a windows and *nix port you can use that too. I have built a couple of apps with it that pull snmp data from routers with it that worked great. I also used a java installer to install the required files. Might be worth looking into since it is php based. -- Ray On Fri, 2003-10-24 at 12:20, Raditha Dissanayake wrote: hi, Great to hear that PHP is your language of choice. There are several SOAP libraries available and they come with good docs. However if you are building an image gallery type application, you will be able to do mos of the work just by using java.net package has has been pointed out. all the best Matt Palermo wrote: I don't neccessarily WANT to mix the 2 languages. I just have an application on my webserver that uses MySQL databases and the script is all written in PHP (which I am pretty good at). The only reason I want to use JAVA is so a user can download and install a program that I write (since JAVA is platform independant) that they can run on their local computers. This JAVA program will connect to the server (PHP files) and send back all the information to the JAVA app. This way, the user doesn't even have to go to the website for this script. They can just open the JAVA program and it will be passed all the neccessary information. I'm just a beginner in JAVA, so it will probably take me quite a while to figure out how to build a whole program like this. Eventually, I want it to be similar to the Gallery Remote program (found at: http://gallery.menalto.com/) for a PHP image gallery. I got a long way to go before I will have this created though, since I'm very new to JAVA (I'm much stronger in PHP). Anyway, I'm sure you get the idea. Matt Raditha Dissanayake [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, For this scenario, Ray's suggestion of SOAP is IMHO the best option. But just out of curiosity why do you want to mix the two languages? If you are familiar with java you might be better off doing your server side stuff using J2EE. Then you might be able to use Object Streams for your communications or RMI. Then there is the XMLEncoder class that was made availble with 1.4 better stop before someone shoots me down this is a PHP list after all :-) Matt Palermo wrote: I have been searching the web for ways to execute remote PHP files through the use of JAVA code, but I haven't had any luck. I have found many ways to call JAVA functions from a PHP script, but not the other way around. What I'm trying to accomplish is I want to build a JAVA application that will be run from a users local computer after installation and this JAVA program will connect to a url on my server (a url to a PHP script). This PHP script will be used to connect to the server's MySQL database and send some retrieved information back to the JAVA application on the users machine. I have been searching the web for hours trying to find a tutorial, or advice on how to accomplish this, but so far I have had no luck. If anyone has any advice or suggestions please let me know. Thanks, Matt -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha/megaupload/ Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha/megaupload/ Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using PHP with JAVA
Yeah, http://gtk.php.net Also they have a mailing list that you can join and get help from those experienced users. HTH -- Ray On Fri, 2003-10-24 at 13:26, Matt Palermo wrote: I don't know much about that, but it definitely sounds better, escpecially since it's still PHP based. Do you know of any websites or tutorials I can go to to learn more about it? It sounds like a much better option. Thanks, Matt Ray Hunter [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Also, I would like to point out that you could possibly use php-gtk to do some gui applications. Since it has a windows and *nix port you can use that too. I have built a couple of apps with it that pull snmp data from routers with it that worked great. I also used a java installer to install the required files. Might be worth looking into since it is php based. -- Ray On Fri, 2003-10-24 at 12:20, Raditha Dissanayake wrote: hi, Great to hear that PHP is your language of choice. There are several SOAP libraries available and they come with good docs. However if you are building an image gallery type application, you will be able to do mos of the work just by using java.net package has has been pointed out. all the best Matt Palermo wrote: I don't neccessarily WANT to mix the 2 languages. I just have an application on my webserver that uses MySQL databases and the script is all written in PHP (which I am pretty good at). The only reason I want to use JAVA is so a user can download and install a program that I write (since JAVA is platform independant) that they can run on their local computers. This JAVA program will connect to the server (PHP files) and send back all the information to the JAVA app. This way, the user doesn't even have to go to the website for this script. They can just open the JAVA program and it will be passed all the neccessary information. I'm just a beginner in JAVA, so it will probably take me quite a while to figure out how to build a whole program like this. Eventually, I want it to be similar to the Gallery Remote program (found at: http://gallery.menalto.com/) for a PHP image gallery. I got a long way to go before I will have this created though, since I'm very new to JAVA (I'm much stronger in PHP). Anyway, I'm sure you get the idea. Matt Raditha Dissanayake [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, For this scenario, Ray's suggestion of SOAP is IMHO the best option. But just out of curiosity why do you want to mix the two languages? If you are familiar with java you might be better off doing your server side stuff using J2EE. Then you might be able to use Object Streams for your communications or RMI. Then there is the XMLEncoder class that was made availble with 1.4 better stop before someone shoots me down this is a PHP list after all :-) Matt Palermo wrote: I have been searching the web for ways to execute remote PHP files through the use of JAVA code, but I haven't had any luck. I have found many ways to call JAVA functions from a PHP script, but not the other way around. What I'm trying to accomplish is I want to build a JAVA application that will be run from a users local computer after installation and this JAVA program will connect to a url on my server (a url to a PHP script). This PHP script will be used to connect to the server's MySQL database and send some retrieved information back to the JAVA application on the users machine. I have been searching the web for hours trying to find a tutorial, or advice on how to accomplish this, but so far I have had no luck. If anyone has any advice or suggestions please let me know. Thanks, Matt -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha/megaupload/ Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha/megaupload/ Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php