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

  • 相关阅读:
    codeforces689A
    codeforces222A
    codeforces553A
    2021牛客国庆集训派对day6 J
    SVM--支持向量机
    压缩感知
    范数
    LeNet详解
    卷积神经网络(CNN)详解
    BP算法实例—鸢尾花的分类(Python)
  • 原文地址:https://www.cnblogs.com/kwishly/p/3491104.html
Copyright © 2011-2022 走看看