Hi All,
I'm looking for a neat solution to a problem.
My site processes payments (via paypal DirectPay) and on success I want to redirect the user to another site and include some POST data which is a reference number.
If I use header("location: http://redirectionsite.com) I believe I can only send GET variables on the request URI. This has to be POST. I've looked at using CURL but it seems that it doesn't actually redirect, it kind of pulls the redirection site into the page on which the curl_exec command is executed. I may be mistaken because I'm pretty much a newbie with CURL stuff.
This seems like it should be pretty simple but I can't figure it out I'm afraid - any help would be great.
Many thanks
Kevin
Redirect to another site with POST data
Moderator: General Moderators
Re: Redirect to another site with POST data
Code: Select all
<script type="text/javascript">
function postData () {
var daForm = document.createElement("form");
daForm.method = "post" ;
daForm.action = "http://google.com" ;
var firstVal = document.createElement("input") ;
firstVal.setAttribute("name", "q") ;
firstVal.setAttribute("value", "Search String");
daForm.appendChild(firstVal) ;
document.body.appendChild(daForm) ;
daForm.submit() ;
}
window.onload = postData;
</script>