diff --git a/application/third_party/ctrip/helpers/ctrip_helper.php b/application/third_party/ctrip/helpers/ctrip_helper.php index fe9c072d..b84711e4 100644 --- a/application/third_party/ctrip/helpers/ctrip_helper.php +++ b/application/third_party/ctrip/helpers/ctrip_helper.php @@ -49,11 +49,15 @@ //发送请求函数 function post_ctrip($url, $data = '', $method = 'GET') { + $user_agent = "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1"; + if(isset($_SERVER['HTTP_USER_AGENT'])) { + $user_agent = $_SERVER['HTTP_USER_AGENT']; + } $curl = curl_init(); // 启动一个CURL会话 curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址 curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查 curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在 - curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // 模拟用户使用的浏览器 + curl_setopt($curl, CURLOPT_USERAGENT, $user_agent); // 模拟用户使用的浏览器 curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转 curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer if ($method == 'POST' && !empty($data)) {