PHP转发数据发布 [英] PHP forward data post
本文介绍了PHP转发数据发布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正尝试在不使用cURL的情况下将数据从一页转发到另一页,这可能吗?
I am trying to forward data from one page to another without using cURL, is this possible?
此刻我已经尝试过
header('HTTP/1.1 307 Temporary Redirect');
header('Location: new-location.php');
这很好用,但是给出了一个愚蠢的弹出框,还有其他方法吗?
This works nicely but gives a stupid pop up box, any other methods?
我尝试使用curl但没有任何反应,不确定是否在我的服务器上启用了它!
I have tried using curl but nothing happens, not sure if its enabled on my server!
推荐答案
我认为,以下是实现此目的的唯一可能方法,而不是使用位置标头重定向,请发送此html:-
I think following is the only possible way to achieve that, instead of redirecting with location header, send this html:-
<!DOCTYPE html>
<html>
<body onload="document.forms[0].submit()">
<form action="new-location.php" method="post">
<?php foreach( $_POST as $key => $val ): ?>
<input type="hidden" name="<?= htmlspecialchars($key, ENT_COMPAT, 'UTF-8') ?>" value="<?= htmlspecialchars($val, ENT_COMPAT, 'UTF-8') ?>">
<?php endforeach; ?>
</form>
</body>
</html>
这篇关于PHP转发数据发布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文