tencent-模拟请求头
来源:互联网 发布:ptc软件收费模式 编辑:程序博客网 时间:2024/05/16 11:09
最近...不多说,说多了都是泪,直接上问题和答案:
不使用CURL函数分别写出client.php和server.php两个文件内容.
client.php模拟浏览器客户端向server.php发送如下HTTP数据包.
server.php向client.php输出md5(username+password)后的结果
POST http://localhost/server.php HTTP/1.1
Accept: image/jpeg, image/gif, image/pjpeg, */*
User-Agent: Mozilla/4.0
Content-Type: application/x-www-form-urlencoded
Host: localhost
Content-Length: 34
Connection: Keep-Alive
Cookie: HOSUPPORT=1; UBI=fi_Pnc;
username=a&password=c&action=login
相关资料:http://www.cnblogs.com/zhenbianshu/p/4929767.html
可运行代码:http://blog.csdn.net/debug_zhang/article/details/52179270
//假设host:localhost//Client.php文件内容为:$url = "http://localhost/server.php";$fp = fsockopen ( "localhost", 80, $errno, $errstr, 3 );$head = "POST /server.php HTTP/1.0\r\n";$head .= "Accept: image/jpeg, image/gif, image/pjpeg, */*\r\n";$head .= "User-Agent: Mozilla/4.0\r\n";$head .= "Content-type: application/x-www-form-urlencoded\r\n";$head .= "Host: localhost\r\n";$head .= "Content-Length: 34\r\n";$head .= "Connection: Keep-Alive\r\n";$head .= "Cookie: HOSUPPORT=1; UBI=fi_Pnc;\r\n";$head .= "\r\n"; $head .= trim ( "username=a&password=c&action=login" );$write = fputs ( $fp, $head );fgets ( $fp );while ( ! feof ( $fp ) ) {$line = fgets ( $fp );echo $line . "<br>";} //Server.php内容为:echo md5($_POST['username'].$_POST['password']);
0 0
- tencent-模拟请求头
- perl 模拟curl 自定义请求头
- HttpClient设置请求头模拟浏览器
- firefox伪造请求头信息,模拟手机访问网站
- firefox伪造请求头信息,模拟手机访问网站
- HttpClient设置请求头消息User-Agent模拟浏览器
- 模拟请求
- PHP CURL模拟JQuery的Ajax请求头(添加可显示在_SERVER中的参数)
- php 构造http头 php模拟http请求 伪装头部信息
- curl模拟数据请求,在header头中设置自定义的参数
- http请求头响应头
- 请求头和响应头
- 请求头、响应头小记
- Http请求头、响应头
- 响应头与请求头
- HTTPS请求添加请求头
- 模拟今日头条
- 今日头条模拟
- 动态规划:考试通过概率
- 复选框点击后弹出输入框
- 跟益达学Solr5之使用Tika从PDF中提取数据导入索引(转字:http://www.tuicool.com/articles/JfUfaey)
- 方法的覆写原则--------一同两大一小
- jsp页面现在td标签显示长度 与 设置普通字符串显示字体长度
- tencent-模拟请求头
- java并发——四种创建线程方式
- nginx限制每个ip访问的频率和并发量
- 浅谈VB.NET
- POJ2955Brackets(区间DP模板题)
- OpenCV中SVM在Android端使用
- 数据结构学习:栈的模板类实现
- C#基础
- MySQL 1366 错误的解决办法