$ch = Curl_init ();
# Set the URL and return the result, whether return to the head curl_setopt ($ch, Curlopt_url, ' http://www.baidu.com/');
curl_setopt ($ch, Curlopt_returntransfer, 1);
curl_setopt ($this->ch, Curlopt_header, 1);
# cookie File Set curl_setopt ($this->ch, Curlopt_cookiejar, $cookie _file);
curl_setopt ($this->ch, Curlopt_cookiefile, $cookie _file);
# Extra Head curl_setopt ($this->ch, Curlopt_httpheader, Array (' user-agent:mozilla/5.0 '));
# set POST curl_setopt ($ch, Curlopt_post, 1);
curl_setopt ($ch, Curlopt_postfields, $poststring);
# connection, execution Expiration time curl_setopt ($this->ch, Curlopt_connecttimeout, 5);
curl_setopt ($this->ch, Curlopt_timeout, 5);
# whether following the 302 curl_setopt ($this->ch, curlopt_followlocation, 1);
curl_setopt ($this->ch, Curlopt_maxredirs, 10);
# refer curl_setopt ($this->ch, Curlopt_referer, $refer); # HTTP version and port reuse settings curl_setopt ($this->ch, Curlopt_http_version, curl_http_version_1_1);
curl_setopt ($this->ch, Curlopt_forbid_reuse, 1);
# support HTTPS curl_setopt ($this->ch, Curlopt_ssl_verifypeer, 0);
curl_setopt ($this->ch, curlopt_ssl_verifyhost, 0);
# Executive curl_setopt ($this->ch, curlopt_nosignal, 1);
$response = curl_exec ($ch);
if (Curl_errno ($ch)) {curl_error ($ch);
Exit (); } curl_close ($ch);
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/PHP/