Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/271.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将PHP表单POST值发送到CGI url?_Php_Forms_Post_Request_Cgi - Fatal编程技术网

如何将PHP表单POST值发送到CGI url?

如何将PHP表单POST值发送到CGI url?,php,forms,post,request,cgi,Php,Forms,Post,Request,Cgi,我想将php值发送到cgi url <form method="post" action="https://192.168.10.1:10443/cgi-bin/outgoingfw.cgi/cgi-bin/outgoingfw.cgi" style="float:left"> <input name="ACTION" value="disable" type="hidden"> <i

我想将php值发送到cgi url

 <form method="post" action="https://192.168.10.1:10443/cgi-bin/outgoingfw.cgi/cgi-bin/outgoingfw.cgi" style="float:left">
                    <input name="ACTION" value="disable" type="hidden">
                    <input name="line" value="0" type="hidden">
                </form>
我想通过PHP POST请求将这些值发送到url


有人能帮我怎么做吗。

您缺少一个提交按钮

  <form action="https://192.168.10.1:10443/cgi-bin/outgoingfw.cgi/cgi-bin/outgoingfw.cgi" method="POST">
       <input type="submit" value="Publish">
       <input name="ACTION" value="disable" type="hidden">
       <input name="line" value="0" type="hidden">
 </form>

进一步参考:

只需添加一个提交按钮,就可以了

     <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form method="post" action="https://192.168.10.1:10443/cgi-bin/outgoingfw.cgi" style="float:left">
    <input name="ACTION" value="disable" type="hidden">
    <input name="line" value="0" type="hidden">

    <!-- submit button -->
    <input type="submit" value="submit"/>

</form>
</body>
</html>

如果你想自动发送。没有按下按钮。否则,为什么需要隐藏字段

  <form method="post" action="https://192.168.10.1:10443/cgi-bin/outgoingfw.cgi/cgi-bin/outgoingfw.cgi" style="float:left">
        <input name="ACTION" value="disable" type="hidden">
        <input name="line" value="0" type="hidden">
    </form>
    <script>
        document.getElementsByTagName('form')[0].submit();
    </script>

在action属性中有两次cgi bin/outgoingfw.cgi。您还可以查看更多信息。查找cURL:但值没有传递任何内容。我编辑了答案以显示完整代码。这是可行的,我在我的服务器上试过了,它也行。当然,您只是发布了一个empy行变量。我无法访问您的,所以它只返回一个错误,但是表单是postedbtw,除非您需要,否则您不应该使用javascript发布表单。在不需要javascript的情况下使用javascript是不好的编码,它只会使它更复杂、更慢,并没有添加任何内容但值没有传递任何内容尝试插入我的代码并在浏览器中打开网络,您将看到请求已被发送如果您想在页面上获得答案,则需要使用我尝试了您的代码,但页面重定向到页面,但值没有传递该页面上没有发生任何操作