curl模拟post请求提交
来源:互联网 发布:端口号怎么设置 编辑:程序博客网 时间:2024/06/09 21:29
<?php
$ch = curl_init();
$url = '***';
curl_setopt($ch, CURLOPT_HTTPHEADER , $header);
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:50.0) Gecko/20100101 Firefox/50.0');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
// 执行HTTP请求
curl_setopt($ch , CURLOPT_URL , $url);
$res = curl_exec($ch);
$ch = curl_init();
$url = '***';
$header = array('cookie:打开firebug的cookie参数'
);
注意空格要去除。
curl_setopt($ch, CURLOPT_HTTPHEADER , $header);
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:50.0) Gecko/20100101 Firefox/50.0');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
// 执行HTTP请求
curl_setopt($ch , CURLOPT_URL , $url);
$res = curl_exec($ch);
var_dump($res);
注:如果是https的请求的话,加上以下两个参数
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); 即可
0 0
- curl模拟post请求提交
- curl模拟post请求提交
- curl模拟post请求提交
- curl模拟post请求提交
- curl模拟post请求提交
- curl模拟post请求提交
- curl模拟post请求提交
- curl模拟post请求提交
- curl模拟post请求提交
- curl模拟post请求提交
- curl模拟post请求提交
- curl模拟post请求提交
- curl模拟post请求提交
- CURL模拟POST请求提交
- curl模拟post请求提交
- curl模拟post请求提交
- curl模拟post请求提交
- curl模拟post请求提交
- OpenCV--图像二值化处理
- mysql--设置表的属性自动增加
- 随手记-技能拆分
- Ubuntu下Android开发环境配置
- Channel.write() 和 ChannelHandlerContext.write() 的区别
- curl模拟post请求提交
- vs如何新建项目
- liunx之sed命令详解
- log4j+logback+slf4j的关系与调试
- Fiddler界面简介
- 凑算式 dfs
- 网络小故障-20170204
- Git 本地提交
- Codeforces 514C Watto and Mechanism【字典树+Dfs】好题!