0

I have a form which submits to a external url and the url returns a xml result whether the action did go well or not. I want the form to be posted and the xml result to returned so the user can see the xml result instead of the external url being opened in blank window without any formatting.

I'm not sure how to make this.

1
  • you want to change the styling of an external XML? Commented Sep 28, 2011 at 13:25

1 Answer 1

1

Instead of posting the form directly to the external script, you will need to wrap it in your own PHP code to be able to deliver the XML back to your user to view.

To do this, you can:

  1. Make the form post to itself instead of directly to the external resource
  2. Capture the $_POST
  3. Transfer it to a cURL request that posts to the external form
  4. Retrieve the output from the cURL request and display it for your user, wrapped in <pre></pre> to preserve XML formatting.

Note however, that some web browsers will correctly display the returned XML as it already is, provided it is correctly identified as XML by the server sending it. You don't have control over that on either the external server or your end user clients though.

Sign up to request clarification or add additional context in comments.

3 Comments

Hi Michael, Thank you for the walkthrough of the process. Just what i needed to figure out the correct method. I'll try it out! :)
Could you give an example on how the cURL set-up should be, my first time with cURl.
No need, found the solution. Thanks again!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.