file_get_contents fsocketopen分别模拟http请求
来源:互联网 发布:网络摄像头内部结构图 编辑:程序博客网 时间:2024/05/21 15:41
<?php$data=array( 'name'=>'12345', 'title'=>'12345' );$data=http_build_query($data);$opts=array( 'http'=>array( 'method'=>'POST', 'header'=>"Content-type:application/x-www-form-urlencoded\r\nContent-Length: ".strlen($data)."\r\n", 'content'=>$data ));$context=stream_context_create($opts);for($i=0;$i<=10000;$i++){ $html=file_get_contents('http://localhost/test/post.php',false,$context);}<?phpif(!empty($_POST)){ mysql_connect("localhost","root",""); mysql_query("set name utf8"); mysql_query("use test"); $sql='insert into test (name,title)values ("'.$_POST['name'].'","'.$_POST['title'].'")'; echo $sql; if(mysql_query($sql)){ echo "ok"; }else{ echo "fail"; }}?><html> <body> <form action="" method="post"> <input type="text" name="title"/> <input type="text" name="name"> <input type="submit" value="提交"> </form> </body></html>create table test (id int primary key auto_increment,name varchar(255) not null default '',title varchar(255) not null default '')engine=myisam charset=utf8;<?phperror_reporting(E_ALL);$data=array( 'name'=>'12345', 'title'=>'12345');$data=http_build_query($data);$out='';$out.="POST http://localhost/test/post.php HTTP/1.1\r\n";$out.="Host: localhost\r\n";$out.="Content-type: application/x-www-form-urlencoded\r\n";$out.='Content-Length: '.strlen($data)."\r\n\r\n";$out.=$data."\r\n\r\n";for($i=0;$i<=1000;$i++){ $fp=fsockopen("localhost",80,$errno,$errstr,5000); fwrite($fp,$out);}fclose($fp);我在本地模拟http请求
0 0
- file_get_contents fsocketopen分别模拟http请求
- fsocketopen,curl,file_get_contents
- file_get_contents模拟GET/POST请求
- PHP 模拟CURL分别GET POST进行HTTP请求
- PHP用socket模拟post之fsocketopen
- HttpWebRequest 模拟Http请求
- telnet模拟Http请求
- Jave 模拟 http 请求
- http请求模拟
- telnet模拟HTTP请求
- 模拟http 请求
- PHP模拟http请求
- HTTP 模拟post请求
- 模拟发送http请求
- socket模拟http请求
- 模拟HTTP请求
- c#模拟http请求
- C# 模拟 Http 请求
- C动态库、静态库基础
- cocos2d-x中的adddChild函数中的zOrder参数理解和实际显示效果
- iOS开发一些实用的小方法
- HDU 1814 Peaceful Commission(2-SAT:最小字典序)
- CPSR_当前程序状态寄存器
- file_get_contents fsocketopen分别模拟http请求
- Andriod由0开始(入门到精通)
- Python 逻辑运算返回值
- uva 11754 - Code Feat(中国剩余定理+暴力)
- C语言中枚举的简单介绍
- 零零碎碎的总结
- 哪本书是对程序员最有影响、每个程序员都该阅读的书?
- Amazon Dynamo论文解读 - Merkle Tree的使用
- object C 中通讯录 以及 正则表达式