struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Pat <>
Subject Re: newbie alert: forward to a php script
Date Tue, 17 Apr 2007 15:37:57 GMT
Sorry for the persistence/naivete of this, however can someone tell me if this is possible
and how?  It will be a learning experience for me and I appreciate any insight.  

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 stupid, 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.


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

  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message