I found that this code works almost all the time (except when you want to forward using personalized mail data and the client does not support javascript).
This is done by abusing the 307 Temporary Redirect , which seems to be sending POST data or by creating a self-submitting javascript form.
This is a hack, but use it only if you SHOULD forward POST data.
<?php function redirectNowWithPost( $url, array $post_array = NULL ) { if( is_null( $post_array ) ) { </form> <script type="text/javascript"> document.forms[0].___submit___(); </script> <?php } exit(); } function createHiddenFields( $value, $name = NULL ) { $output = ""; if( is_array( $value ) ) { foreach( $value as $key => $value ) { $output .= createHiddenFields( $value, is_null( $name ) ? $key : $name."[$key]" ); } } else { $output .= sprintf("<input type=\"hidden\" name=\"%s\" value=\"%s\" />", htmlspecialchars( stripslashes( $name ) ), htmlspecialchars( stripslashes( $value ) ) ); } return $output; }
source share