struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurie Harper <>
Subject Re: newbie alert: forward to a php script
Date Tue, 17 Apr 2007 20:16:04 GMT
I'm still not clear why you need the PHP script at all; why not call out 
to the remote server directly from your Java webapp? That would seem to 
be a simpler route.

However, if you really do need the PHP script in there something like 
HttpClient, as suggested by another poster, would probably be the 
easiest way to build and submit the HTTP request.


Chris Pat wrote:
> Hi Laurie
> Thanks.  All I need is to send a HTTP Post request to  the php script with the parameters
that the Action received, but having done some processing in the Action.  At this point I
dont care if the client sees the results of the php output.  I dont see how to generate something
like a RequestDisptacher from within an Action even if I just send the client to a success
page at the end.
> My design problem is that I am trying to talk to a cc processor using struts code.  Right
now the only way I can send the post to the cc processor and receive the response on the same
port is with a php script.  So I thought of splitting it up and using curl to send to the
cc processor after processing it in an Action, receiving it in the php scrip and forwarding
it to another Action for post processing.  I have to get around the fact that the cc processor
will only send back a response on the same port that the port as the request, obviously without
a nicely formatted context/servlet syntax.  I believe this will work, if I can only get a
post sent to the php script which will be a url outside of the Struts framework.  I am sure
this massively violative MVC and probably not scalable, but I just have to get it done.  Thanks
for even the slightest insight, even if saying it is utterly stup
>  id, grin.
> Laurie Harper <> wrote: Chris Pat wrote:
>> Hello
>> Is it possible to have an Action that processes some data and then posts to a url
completely out of control of the framework?  I want to process and write to a db first and
then using the same parameters and any added session variables post to a php script, initially
running on localhost but eventually on a completely different url.  Can someone help me understand
how or why not.  I really need to do it even if it is not to the spec.  Thank you.
> Post to? Sure, you can create an HTTP POST request to any URL. But I 
> suspect that's not quite what you mean. If you mean /forward/ to, as in 
> dispatch to, a PHP script, it's not so straight forward.
> I seem to recall seeing mention on this list in the past of some sort of 
> Java-PHP bridge, which may be what you're looking for. Search the 
> archives (or Google) for 'Java PHP bridge' and see if that turns 
> anything useful up. Alternatively, re-post with clarification of exactly 
> what you want to achieve; maybe someone will be able to give a more 
> specific solution.
> L.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message