Two Laptop Bag*
The moose likes Servlets and the fly likes How to call PHP methods from Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to call PHP methods from Java" Watch "How to call PHP methods from Java" New topic
Author

How to call PHP methods from Java

Sunil Kumar Gupta
Ranch Hand

Joined: Aug 26, 2005
Posts: 824
Hi All,

I hope i will get the answer of my question here, I have a web application in java. And the other application i have is in PHP. PHP application does the job of Authentication from a authentication server based on username and password. Now I want the same PHP authentication methods from my java application when any user enter in java application.

For this I need to call the PHP functions from Java application, Kindly tell me the possible ways to acheive the solution

Thanks


Lack of will power has caused more failure than lack of intelligence or ability.
My Blog | Red5 Resources | Technology Update | Daily Technology Tips
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61095
    
  66

Why not just use Java-based authentication? Building a Rube Goldberg machine to invoke php to do something that's just as easy to do in Java sounds like a less than stellar idea.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Sunil Kumar Gupta
Ranch Hand

Joined: Aug 26, 2005
Posts: 824
Originally posted by Bear Bibeault:
Why not just use Java-based authentication? Building a Rube Goldberg machine to invoke php to do something that's just as easy to do in Java sounds like a less than stellar idea.


I think i missed something, Actually my requirement was little different. I have two applications, one in Java with tomcat session managment and other one in PHP using prado framework for session managment. Now to implement single sign on. I need to pass session information somehow to PHP application if someone enters in Java application and moves to PHP application from there.

I hope i am able to explain the requirement this time.

Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61095
    
  66

Ah, you didn't mention that these apps need to cooperate. Can you not simply issue requests from the Java app to the php app that performs the sign on?
Sunil Kumar Gupta
Ranch Hand

Joined: Aug 26, 2005
Posts: 824
Originally posted by Bear Bibeault:
Ah, you didn't mention that these apps need to cooperate. Can you not simply issue requests from the Java app to the php app that performs the sign on?


I am sorry, but i am not getting your point, Can you explain it a little.

Also passing the user information through URL is not appropriate.Another way is web service.

Any other good way?

Thanks for replying so early Bear.
[ January 07, 2008: Message edited by: Sunil Kumar Gupta ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61095
    
  66

Is this not all protected by SSL? If so, you can easily mimic a post to the other app securely.
 
Don't get me started about those stupid light bulbs.
 
subject: How to call PHP methods from Java