php curl

作者: 可乐_加冰_ | 来源:发表于2020-04-14 15:31 被阅读0次

    纯属凑字数..............
    function curl_post($url, $post_data)

    {

        $curl = curl_init();

        curl_setopt($curl, CURLOPT_URL, $url);

        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);// https请求 不验证证书和hosts

        curl_setopt($curl, CURLOPT_HEADER, 0);

        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

        curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10000);

        curl_setopt($curl, CURLOPT_POST, 1);

        //设置post数据

        curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);

        $data = curl_exec($curl);//执行命令

        curl_close($curl);

        return $data;

    }

    相关文章

      网友评论

          本文标题:php curl

          本文链接:https://www.haomeiwen.com/subject/rhltvhtx.html