php抓取post方式提交的页面
2024-08-25 09:57:39
function curlBy($url, $data=array()) {
$ch = curl_init();
if(!empty($data)){
if (is_array($data) && $data) {
$formdata = http_build_query($data);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $formdata);
}
}
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT,0);
$result = curl_exec($ch);
return $result;
}
注:post的参数以数组形式传到curlBy函数的第二个参数
最新文章
- js事件(Event)知识整理
- koa知识点
- 【分布式协调器】Paxos的工程实现-cocklebur选举
- 3_mysql 主从复制
- Swift开发学习-03 Swift技巧
- ZOJ题目分类
- tq2440开发板基本配置
- silverlight控件动画状态的过渡
- HDU 4727 The Number Off of FFF
- 倒叙筛除list
- 使用AngularJS的三个重要原因
- (23)IO之打印流 PrintStream &; Printwriter
- java课程设计——猜数游戏个人博客
- jQuery-day01-介绍 和 选择器获取元素
- php utf8编码字符串的截取
- django 初始命令
- Go Example--通道遍历
- 手机调试 fiddler
- Pipeline 与 xargs
- ajax访问当前页面后的 [WebMethod]描述的方法
热门文章
- JAVA错误:Cannot refer to a non-final variable * inside an inner class defined in a different method
- js 倒计时(转)
- [SQL]根据刚刚插入数据的 ID 向另外一张表插入数据(插入的其他字段数据需要对字符串进行分析)
- Android--输入自动提示AutoCompleteTextView
- (转).NET代码混淆实践
- chinapay
- OpenGL的学习与认识
- 如何隐藏storyboard中的top bar
- Redis附加功能之Redis流水线pipeline
- The Ninth Hunan Collegiate Programming Contest (2013) Problem J