0

I'm having an issue with my PHP script where it is not receiving necessary POST data that is sent out from another web domain that I'm using. Essentially, what is happening is that I run and load script A which then sends a payload of POST data to script B and launches it, but script B does not receive anything from script A.

The two scripts are on different domains (https://www.somethingA.com vs http://www.somethingB.com), so that is currently leading me to assume that it is a cross domain issue and is being blocked due to cross domain security restrictions. Is this the case here?

Thanks all for your help.

EDIT:

Here is my code:

Script A

<form method="post" id="myform" name="myform" action="http://www.somethingB.com" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="lis_result_sourcedid" value="9e45315-4566-351e">
<input type="hidden" name="lis_outcome_service_url" value="https://outcome-service-url.com">
<input type="hidden" name="lti_message_type" value="basic-lti-launch-request">
<input type="hidden" name="oauth_version" value="1.0">
<input type="hidden" name="oauth_nonce" value="974512358">
<input type="hidden" name="oauth_timestamp" value="1563511254">
<input type="hidden" name="oauth_signature_method" value="HMAC-SHA1">
<input type="hidden" name="oauth_consumer_key" value="print">
<input type="hidden" name="oauth_callback" value="about:blank">
<input type="hidden" name="oauth_signature" value="oaijAweiojawewfaw=">
<input type="submit" name="basiclti_submit" value="Launch Endpoint with BasicLTI Data">
</form>
</div>
            <script>
                document.getElementById('ltiLaunchFormSubmitArea').style.display = 'none';
                nei = document.createElement('input');
                nei.setAttribute('type', 'hidden');
                nei.setAttribute('name', 'basiclti_submit');
                nei.setAttribute('value', 'Launch Endpoint with BasicLTI Data');
                document.getElementById('myform').appendChild(nei);
                document.myform.submit();
            </script>
</body>
</html>

...and Script B

print_r($_REQUEST);
hRdCoder
  • 579
  • 7
  • 30
  • can you post any of your code? – starvator Sep 29 '14 at 18:31
  • 1
    http://stackoverflow.com/questions/298745/how-do-i-send-a-cross-domain-post-request-via-javascript and use `header("access-control-allow-origin: *");` for PHP – S.Pols Sep 29 '14 at 18:32
  • @S.Pols Will the header method work if I put it at the top of my receiving script, or will it need to be attached to the sending script? – hRdCoder Sep 29 '14 at 18:39
  • 1
    Yes it will. Check this for more information about `access-control-allow-origin`. http://stackoverflow.com/questions/10636611/how-does-access-control-allow-origin-header-work – S.Pols Sep 29 '14 at 18:44
  • Did you put the correct script in the action attribute of the form? – Seshoumaro Sep 29 '14 at 18:44
  • Yes. I receive an empty array when I check the $_REQUEST array in script B. – hRdCoder Sep 29 '14 at 18:57
  • I'm still unable to get it to work. Is the access-control-allow-origin header all that I need? – hRdCoder Sep 29 '14 at 19:06

0 Answers0