This article describes the content of the PHP function Curl Request-Crawl page/interface test, has a certain reference value, now share to everyone, the need for friends can refer to
/** * Curl Request * * @param string $requesturl//Request URL * @param string $reuqestmothed//Request method default False (Get) True (for POS T) * @param int $httpcode//HTTP status code passed as a reference * @param int $postdata//Post data * @return string or False */function CURLR Equest ($requesturl, $reuqestmethod =false,& $httpcode =0, $postdata =null) {try {$options = array (C Urlopt_url = $requesturl, Curlopt_returntransfer = true,//enable back to return data Curlopt_followlocati On = True,//follow redirects curlopt_ssl_verifypeer = 0, Curlopt_ssl_verifyhost = > 0, Curlopt_post = $reuqestmethod); if (true=== $reuqestmethod) {$options [curlopt_postfields] = $postdata; } $ch = Curl_init ();//Initialize Curl_setopt_array ($ch, $options);//Parameter Set $rs = Curl_exec ($ch);//execute S $H Ttpcode =curl_getinfo ($ch, Curlinfo_http_code); HTTP status Code curl_close ($ch); Unset ($ch); RetuRN $rs; }catch (Exception $ex) {throw $ex; }}