0

I have a page which executes some queries and after completing

header('Location: '.url_money.'SyncComp.php?Comp=YES');

It gets redirected to other page. But I want to send it through HTTP Post

This ?Comp=YES should not be appended to URL instead send by HTTP Post.

I cannot use onLoad of JavaScript as it would directly call the function before executing the sql queries

Sam
  • 7,252
  • 16
  • 46
  • 65
user32876
  • 65
  • 2
  • 12

1 Answers1

0

This is not possible. While their are options you can pass to curl to allow things (--post301 and --post302), no browser supports being told to do a redirect via POST.

You will need to do this via a form and javascript instead. Something like:

<form action="<?= url_money.'SyncComp.php' ?>" method="POST">
    <input type="hidden" name="Comp" value="YES" />
    <input type="submit" />
</form>
<script type="text/javascript">document.forms[0].submit();</script>
<?php die(); ?>
  • But.. The page gets called.. its exexcutes its work and in the end makes the redirect – user32876 Apr 15 '14 at 19:49
  • Yes, but you can't make that redirect a POST without using a form. The form I provided is to be used after the page does all its work, instead of doing a `Location` redirect. –  Apr 15 '14 at 19:51
  • This much script will be the header . I just have to replace it with my header..After my php gets executed.. this will run after that – user32876 Apr 15 '14 at 19:53