php+socket模拟get,post请求
来源:互联网 发布:jy淘宝店外设 编辑:程序博客网 时间:2024/05/02 20:52
它可以伪造c
ookie,refefer头信息,可以用于批量发贴。数据采集。
<?phpclass Http {public $requestUrlInfo=array();public $requestLine;//请求行public $requestHeader=array();//请求头信息public $requestBody;//请求主体信息public $fh=null;/** * 分析 url 并且连接上url */public function __construct($url){$this->requestUrlInfo=parse_url($url);if(!isset($this->requestUrlInfo['port'])){$this->requestUrlInfo['port']=80;}if(!isset($this->requestUrlInfo['path'])){$this->requestUrlInfo['path']='/';}$this->fh=fsockopen($this->requestUrlInfo['host'],$this->requestUrlInfo['port']);}/** * 构造 请求行和请求头,主体信息 * @param unknown_type $method * @param unknown_type $url */public function writeReqeustLineAndHeaderAndBody($method="GET",$postParameters=array()){set_time_limit(0);$this->requestLine=$method.' '.$this->requestUrlInfo['path'].'?'.$this->requestUrlInfo['query'].' HTTP/1.1';$this->requestHeader[]='Host:'.$this->requestUrlInfo['host'];if($method=='POST'){$this->requestHeader[]='Content-Type:application/x-www-form-urlencoded';$this->requestBody=http_build_query($postParameters);$this->requestHeader[]='Content-Length:'.strlen($this->requestBody);}$arr=array_merge(array($this->requestLine),$this->requestHeader,array(''),array($this->requestBody),array(''));$str=implode("\r\n",$arr);fwrite($this->fh, $str);$response='';while (!feof($this->fh)){$response.=fread($this->fh,1024);}fclose($this->fh);return $response;}public function setHeader($str){$this->requestHeader[]=$str;}}?>
ookie,refefer头信息,可以用于批量发贴。数据采集。
0 0
- php+socket模拟get,post请求
- [php]模拟socket发送GET,POST请求
- php socket模拟POST GET请求 fsockopen版
- 用socket模拟php中get,post
- PHP:stream_context_create函数模拟POST/GET请求
- php中使用curl模拟get请求和post请求
- Socket模拟GET请求
- PHP模拟post,get
- php post get请求
- php get post 请求
- PHP 模拟CURL分别GET POST进行HTTP请求
- PHP Socket实现HTTP GET POST请求发送
- PHP模拟POST请求
- PHP模拟POST请求
- PHP模拟post请求
- fsockopen 模拟 post get 请求
- python get post模拟请求
- HTTPCLIENT POST GET请求模拟
- CMarkUp使用简介
- PBR (policy-Based routing,策略路由)总结
- android中scrollview嵌套HorizontalScrollView导致横向滑动卡顿现象解决
- 知道下载文件的地址,怎么用ie下载
- 原生态纯JavaScript 100大技巧大收集---你值得拥有
- php+socket模拟get,post请求
- Google Protocol Buffer 的使用和原理
- Unix和Linux中比较重要的设备文件
- 从code google svn 项目
- iOS中block简介-作用域
- 数据封装---结构体
- 数据清洗
- 美工切图
- 编译通过,ldd 提示not found