POST Cross Domain HTML Form

I have a very simple HTML form using POST, and its action calls a PHP script on my web server.

Here is the kicker ... the html that contains the form is not hosted on the same server and exists in a different domain. Without explaining this issue with an explanation, this should be done for business reasons. They must exist in these specific areas.

When I submit my form, I refer to the PHP script correctly, but then I try to pull out the POST data and it disappears. I think this is a security issue because I temporarily put the form on the same server as PHP and worked fine.

Is there a way I can get this to work with two separate domains? Thanks in advance.

Edit:

PHP Code (emailTemplate.php):

<?php var_dump($_POST); ?> 

HTML form:

 <form name="emailForm" id="emailForm" method="post" onsubmit="return beforeSubmit();" action="https://***.***.com/emailTemplate.php"> <textarea rows="15" cols="75" id="myHtmlText" name="myHtmlText"></textarea> <input type="text" id="toAddr" name="toAddr" size="60"/> <input type="text" id="fromAddr" name="fromAddr" size="60"/> <input type="text" id="subjectLine" name="subjectLine" size="60"/> <input type="submit" name="Submit" value="Email Letter"> </form> 
+6
html post cross-domain
source share
1 answer

If you are only experiencing a problem in IE, their XSS filter might be to blame. This article contains information about disabling it.

To completely avoid this problem, try submitting your form to a PHP script on your server and in this script create a cURL session that submits the form to another script. The XSS transaction occurs independently of the client web browser, preventing these browser-based security restrictions in the process.

+5
source share

All Articles