Results 1 to 3 of 3
  1. #1
    narik is offline Member
    Join Date
    Jan 2010
    Posts
    2
    Rep Power
    0

    Default How to call php script using Java

    Iam New to Java, can we call php script using java,so anyone can help to solve my doubt

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    5

    Default

    The most direct way to call a PHP script, if the PHP script works on its own, such as a command line script, would be to do it through a child process, such as the Runtime.exec() facility from your [command line] Java application.

    If the PHP script exists within a web server, it is likley best (and probably not even possible to do so other than) to invoke it using the HTTP interface, so using a java HTTP client such as the commons-httpclient.

    I also know of the PHP/Java Bridge project, but that is more like a XML based remote procedure call, and it is mainly for calling java from inside PHP (the other direction than you want here), but it might have some resources to help you get to PHP from in Java, i haven't got into it too much detail yet.

    There is also the Quecius project, which is a Java implementation of a PHP interpreter, in theory it would let you run PHP code inside the Quercious (e.g. Java) based container. Surely there would be some kind of hooks to have other Java pieces invoke a PHP script within the Quercius container, but I suspect this is a bit heavy weight and would take a lot of playing in general to make sure the PHP application will function inside Quercius.

  3. #3
    narik is offline Member
    Join Date
    Jan 2010
    Posts
    2
    Rep Power
    0

    Default Thank U Mr.Travishein

    Thank You Very much for u reply Mr.Travishein

Similar Threads

  1. Java script
    By kirtichopra2003 in forum Advanced Java
    Replies: 1
    Last Post: 12-04-2009, 07:55 PM
  2. java script
    By satti in forum Web Frameworks
    Replies: 0
    Last Post: 06-09-2009, 08:53 AM
  3. Call java Methods from Python Script
    By hofsoc in forum New To Java
    Replies: 1
    Last Post: 02-18-2009, 04:47 PM
  4. [B] How to call Perl script from Java [/B]
    By JavaEmpires in forum Advanced Java
    Replies: 7
    Last Post: 12-19-2008, 03:10 PM
  5. The lasted java script
    By silvia in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 08-07-2007, 05:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •