php中fsockopen模仿post与get详解
来源:互联网 发布:秦美人神奇升级数据 编辑:程序博客网 时间:2024/06/02 16:51
在php中fsockopen函数可以模仿用户去访问一些网站并且还可以带一些常用的信息,如果浏览器,IP,post,get 等等数据,下面我分别一来给大家介绍介绍。[导读] 在php中fsockopen函数可以模仿用户去访问一些网站并且还可以带一些常用的信息,如果浏览器,IP,post,get 等等数据,下面我分别一来给大家介绍介绍。如果你要使用fsockopen函数我们必须在php ini中把allow_url
如果你要使用fsockopen函数我们必须在php.ini中把allow_url_fopen = On 设置为开启状态。
伪造post提交
POST HTTP请求(URL)并获取返回值
简要说明:代码第二行是你的IP地址或域名,第四行是你要POST的页面的具体地址,本例用的是fsockopen.php
fsockopen.php
<?php $srv_ip = 'www.jef.com';//你的目标服务地址. $srv_port = 80;//端口 $url = 'http://www.jef.com/10moth/case10_31.php'; //接收你post的URL具体地址 $fp = ''; $errno = 0;//错误处理 $errstr = '';//错误处理 $timeout = 30;//多久没有连上就中断 $post_str = "user=demo&password=hahaha";//要提交的内容. //打开网络的 Socket 链接。 $fp = fsockopen($srv_ip,$srv_port,$errno,$errstr,$timeout); if (!$fp){ echo('fp fail'); } //拼接http协议头 $content_length = strlen($post_str); $post_header = "POST $url HTTP/1.1\r\n"; $post_header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $post_header .= "User-Agent: MSIE\r\n"; $post_header .= "Host: ".$srv_ip."\r\n"; $post_header .= "Content-Length: ".$content_length."\r\n"; $post_header .= "Connection: close\r\n\r\n"; $post_header .= $post_str."\r\n\r\n"; fwrite($fp,$post_header); $inheader = 1; while(!feof($fp)){//测试文件指针是否到了文件结束的位置 $line = fgets($fp,1024); echo $line; //去掉请求包的头信息 /*if ($inheader && ($line == "n" || $line == "rn")) { $inheader = 0; } if ($inheader == 0) { echo $line; } */ } fclose($fp); // unset ($line); ?>接收POST请求
post.php
<?php echo "username:".$_POST['username']."<br/>"; echo "password:".$_POST['password']; ?>
0 0
- php中fsockopen模仿post与get详解
- php中fsockopen模仿post与get详解
- php中fsockopen模仿post与get详解
- php fsockopen 伪造 post和get方法
- php模仿get,post请求。
- PHP中 GET 与 POST
- php socket模拟POST GET请求 fsockopen版
- php 利用fsockopen GET/POST 提交表单及上传文件
- php 利用fsockopen GET/POST 提交表单及上传文件
- PHP 利用 fsockopen GET/POST 提交表单及上传文件
- PHP中Get()和Post()用法详解
- fsockopen手工GET/POST数据
- fsockopen 模拟 post get 请求
- PHP中post与get的区别
- PHP中post与get的区别?
- PHP中post与get的区别
- PHP中post与get的区别
- PHP中GET与POST的区别
- js打印和ie自带打印(从别的地方复制过来的方便自己以后用)
- Android 源码编译 libc++.so
- 牛顿法与拟牛顿法学习笔记(五)L-BFGS 算法
- mysql explain用法
- 数据库技术及应用
- php中fsockopen模仿post与get详解
- 【C++面向对象】重载++操作符
- LeetCode #377 - Combination Sum IV - Medium
- win7 x64 上安装theano
- 将App设置为设备的启动应用
- ViewPager和ListView
- Android--RecyclerView,SwipeRefreshLayout相关
- 阿里百川码力APP监控 来了!
- 冒泡、选择、插入、归并、快速排序代码