$url1 = 'http://mk.2000tuan.com/coupon4/apiv2/getMcoupon.php; function curlGet($url) { $handle = curl_init(); curl_setopt($handle, CURLOPT_URL, $url); curl_setopt($handle, CURLOPT_RETURNTRANSFER, true); curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false); $result = exeBySetTimes(3, $handle); curl_close($handle); return $result; } function exeBySetTimes($count, $curl) { $result = curl_exec($curl); if (curl_errno($curl)) { echo("请求错误: " . curl_errno($curl)); if ($count > 0) { $count--; $result = exeBySetTimes($count, $curl); } } return $result; } var_dump(curlGet($url1));