码迷,mamicode.com
首页 > Web开发 > 详细

PHP之POST方法

时间:2016-01-13 12:27:56      阅读:153      评论:0      收藏:0      [点我收藏+]

标签:

function post($url, $postData = ‘‘, $timeout = 5)
?{
        $ch = curl_init();
        curl_setopt ($ch, CURLOPT_URL, $url);
        curl_setopt ($ch, CURLOPT_POST, 1);
        if ($postData != ‘‘)
        {
            curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
        }
        curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
        curl_setopt($ch, CURLOPT_HEADER, false);
        $result = curl_exec($ch);
        curl_close($ch);
        return $result;
}

 

PHP之POST方法

标签:

原文地址:http://www.cnblogs.com/bitwolf/p/5126609.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!