function doCurl($url, $data = null) $data 数组, $url 路径 { global $configs; if (empty($url)) return false; $curl = curl_init(); //设置超时 curl_setopt($curl, CURLOPT_TIMEOUT, 30); curl_setopt($curl, CURLOPT_URL, $url); if (!empty($data)) { curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $data); } curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($curl, CURLOPT_HEADER, FALSE); curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); $res = curl_exec($curl); curl_close($curl); return (!$res) ? false : $res; } $stockCode = 600000; $url = "http://money.finance.sina.com.cn/corp/go.php/vMS_MarketHistory/stockid/{$stockCode }.phtml"; //var_dump(doCurl($url));
22222222222222222222222222222