dsi36131 2014-09-11 02:36
浏览 32
已采纳

使用cURL将表单数据发布到简单表单

I have a simple example form myForm.php

<html>
<head>
<title>Curling and Enjoying?</title>
</head>
<body>
<form action="print.php" method="post">
   <p>First name: <input type="text" name="firstname" /></p>
   <p>Last name: <input type="text" name="lastname" /></p>
   <input type="submit" name="submit" value="Submit" />
</form>
</body>
</html>

And the a php script which handles the POST action by simply printing the values entered in the two inputs on the previous page, print.php

<?php
   echo("First name: " . $_POST['firstname'] . "<br />
");
   echo("Last name: " . $_POST['lastname'] . "<br />
");
?>

If possible, how can I use cURL to get a correct HTML response by submitting arguments to the server when posting data to the form

When I run the command:

$ curl -d "firstname=Ray&lastname;=Charles" http://mysiteurl.com/myForm.php

I get only the HTML from myForm.php

  • 写回答

1条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥20 b站私信完整导出的方法
      • ¥15 边界图中的x、y轴解释
      • ¥30 如何用matlab求解复杂方程
      • ¥15 VUE TS中怎么调用第三方js
      • ¥15 Activiti如何将值传入textValue
      • ¥20 在linux里安装lummps时 在make mpi里找不到rpc
      • ¥25 python先到先得调度和轮询调度
      • ¥15 SDK Manager闪退
      • ¥15 intel i219v mac地址修改问题
      • ¥15 leetcode上面的题,求解