From 9e98b30a77e711d88450b5a7b21eb070fab5149b Mon Sep 17 00:00:00 2001 From: cyc Date: Thu, 11 Oct 2018 11:46:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0php=20curl=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E8=B6=85=E6=97=B6=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../third_party/tuniu/controllers/tuniu_train.php | 11 +++++++++++ .../third_party/tuniu/helpers/tuniu_helper.php | 1 + 2 files changed, 12 insertions(+) diff --git a/application/third_party/tuniu/controllers/tuniu_train.php b/application/third_party/tuniu/controllers/tuniu_train.php index 559fba16..e1c82793 100644 --- a/application/third_party/tuniu/controllers/tuniu_train.php +++ b/application/third_party/tuniu/controllers/tuniu_train.php @@ -19,6 +19,17 @@ class Tuniu_train extends CI_Controller{ $this->load->model("tuniuprice_model"); } + public function test_response(){ + sleep(44); + echo '123'; + } + + public function test_post(){ + $url = 'http://cht.mycht.cn/info.php/apps/tuniu/tuniu_train/test_response/'; + $data = post_tuniu($url,'',$method = 'POST'); + echo $data; + } + //创建请求签名 public function create_sign(){ $time = date('Y-m-d H:i:s',time()); diff --git a/application/third_party/tuniu/helpers/tuniu_helper.php b/application/third_party/tuniu/helpers/tuniu_helper.php index 822429e6..7c6a4324 100644 --- a/application/third_party/tuniu/helpers/tuniu_helper.php +++ b/application/third_party/tuniu/helpers/tuniu_helper.php @@ -45,6 +45,7 @@ curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type:application/json')); } curl_setopt($curl, CURLOPT_TIMEOUT, 45); // 设置超时限制防止死循环 + curl_setopt($curl, CURLOPT_TIMEOUT_MS, 45000); // 设置超时限制防止死循环 curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回 $tmpInfo = curl_exec($curl); // 执行操作