zoukankan      html  css  js  c++  java
  • php抓取post方式提交的页面

         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函数的第二个参数

  • 相关阅读:
    template(2.2)
    Filter过滤链条
    The 3n + 1 problem
    Struts2.3+Spring4.0
    康托展开
    templates(2.1)
    templates(1.2)
    templates(1.1)
    我和你
    Android 的上下文菜单: Context Menu
  • 原文地址:https://www.cnblogs.com/kwishly/p/3491104.html
Copyright © 2011-2022 走看看