Search code examples
phppostmasking

Send $_POST to masked site


I have issue with sending form using PHP.

I have one page domain1.com with script and second domain2.com with masking to first domain.

The second domain domain2.com is visible in browser but the script works under domain1.com

I try send $_POST data from domain2.com to itself, but the $_POST cannot be delivered.

The form head look likes this:

<form method="post" action="http://<?php echo $_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"] ?>">

Then I try var_dump $_POST, but is it NULL.

Me question is: How can i catch $_POST data from masked domain? Is there some hack maybe?

Any idea helps, thank to all.

Example1:

<form method="post" action="http://domain2.com">
<input type="hidden" name="data" value="1" />
<input type="submit" value="send" />
</form>

Example2:

<form method="post" action="http://domain1.com">
<input type="hidden" name="data" value="1" />
<input type="submit" value="send" />
</form>

Solution

  • Simple bottom line. The action= param in the form is where the $_POST will be parsed/handled/whatever.

    Frames are cheap, more like worthless (other ways of doing this stuff that is not frames).

    AJAX and javascript is your friend.

    Without JS, you may be able to have form on domain1 be submitted to domain2 where a header() redirect back to domain1.

    A hack, yes.

    Will it work, probably.

    Would I sign my name to it, no.