Scripting 使用套接字提交表单
我有两页:Scripting 使用套接字提交表单,scripting,mirc,Scripting,Mirc,我有两页: 代码: 硬币: <html> <head><title></title></head> <body> <form action="formsend.php" method="post"> address: <input type="text" name="address"> <br/> age: <input type="text" na
硬币:
<html>
<head><title></title></head>
<body>
<form action="formsend.php" method="post">
address: <input type="text" name="address">
<br/>
age: <input type="text" name="age">
<input type="submit" value="send">
</form>
</body>
</html>
<?php
echo $_POST["address"];
echo "<br />";
echo $_POST["age"];
?>
地址:
年龄:
硬币:
<html>
<head><title></title></head>
<body>
<form action="formsend.php" method="post">
address: <input type="text" name="address">
<br/>
age: <input type="text" name="age">
<input type="submit" value="send">
</form>
</body>
</html>
<?php
echo $_POST["address"];
echo "<br />";
echo $_POST["age"];
?>
现在我如何提交index.html表单并从sentmail.php和mirc中的echo获取值?
我只需要一个例子>了解HTTP请求(在本例中是POST请求)是如何工作的很重要
/default.php
由用户用于向/dira/sentmail.php
提供数据。但是,应用程序发送的POST请求不需要组成表单的HTML。相反,它们只是将原始数据发送到接收文件,在本例中为/dira/sentmail.php
我制作了下面的示例,它应该向您展示POST请求在mIRC(或任何其他语言)中是如何工作的。这可以通过/postForm
触发,然后将所有数据回显到状态窗口中
alias postForm {
var %address = $$1
var %age = $$2
var %sockname = postForm. $+ $ctime
sockopen %sockname emailser1.hostzi.com 80
sockmark %sockname %address $+ , $+ %age
}
on *:SOCKOPEN:postForm.*:{
var %data = address= $+ $gettok($sock($sockname).mark, 1, 44) $+ &age= $+ $gettok($sock($sockname).mark, 2, 44)
sockwrite -nt $sockname POST /dira/sentmail.php HTTP/1.1
sockwrite -nt $sockname Host: emailser1.hostzi.com
sockwrite -nt $sockname Content-Type: application/x-www-form-urlencoded
sockwrite -nt $sockname Content-Length: $len(%data)
sockwrite -nt $sockname $crlf $+ %data
}
on *:SOCKREAD:postForm.*:{
var %sockread
sockread %sockread
echo -st %sockread
}
我希望这对你有帮助。如果您需要对代码进行解释,请随时提问。您是否已经知道如何使用佐助坤的
sockopen
进行连接?