[英]How to send HTTP POST request to another site?
I am trying to send this POST request to another site, but I do not really know how to do so. 我正在尝试将此POST请求发送到另一个站点,但是我真的不知道该怎么做。 Is it even possible with this code?
此代码甚至可能吗?
<html>
<body>
<form method="post">
<input type="hidden"
<?php
echo " value='";
for($i=0;$i<2147483648;$i++)
{
echo "a";
}
echo "'";
?>
>
<input type="submit">
</form>
<?php if(isset($_POST['test'])){
echo $_POST['test'];
}
?>
</body>
</html>
If so, how do I target the website/run this? 如果是这样,我如何定位该网站/运行它?
You could send a POST request to another server by using cURL . 您可以使用cURL将POST请求发送到另一台服务器。 See the example here from David Walsh.
见的例子在这里从大卫·沃尔什。
And if you're stuck with PHP don't throw out good design - encapsulate the logic of your custom cURL code in a function so you only define and change it in a single place. 而且,如果您对PHP不满意,请不要放弃良好的设计-将自定义cURL代码的逻辑封装在一个函数中,以便仅在单个位置定义和更改它。
You have not mentioned action in form tag. 您尚未在表单标签中提及动作。 Action tells where to post the form
行动告诉在哪里张贴表格
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.