美文网首页
php封装curl post请求

php封装curl post请求

作者: 风度翩翩的程序猿 | 来源:发表于2021-04-15 16:18 被阅读0次
    private function post($curlPost, $url)
    {
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_HEADER, false);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_NOBODY, true);
        curl_setopt($curl, CURLOPT_POST, true);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $curlPost);
        $return_str = curl_exec($curl);
        curl_close($curl);
        return $return_str;
    }

相关文章

网友评论

      本文标题:php封装curl post请求

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