PHP Curl function, support post GET
/** * @author default7
* @param $url * @param string $method * @param array $postData * * @return mixed|null|string */function Gethttpcon Tent ($url, $method = ' GET ', $postData = Array ()) {$data = '; if (!empty ($url)) {try {$ch = Curl_init (); curl_setopt ($ch, Curlopt_url, $url); curl_setopt ($ch, Curlopt_header, false); curl_setopt ($ch, Curlopt_returntransfer, 1); curl_setopt ($ch, Curlopt_timeout, 30); 30-second Timeout curl_setopt ($ch, curlopt_followlocation, 1); curl_setopt ($ch, Curlopt_cookiefile, $cookie _jar); if (Strtoupper ($method) = = ' POST ') {$curlPost = Http_build_query ($postData); curl_setopt ($ch, Curlopt_post, 1); curl_setopt ($ch, Curlopt_postfields, $curlPost); } $data = Curl_exec ($ch); Curl_close ($ch); } catch (Exception $e) {$data = null; }} return $data;}
http://www.bkjia.com/PHPjc/871188.html www.bkjia.com true http://www.bkjia.com/PHPjc/871188.html techarticle PHP Curl function, support post GET/** * @author default7 * @param $url * @param string $method * @param array $postData * * @retu RN mixed|null|string */function gethttpcontent ($url,...