Authored by 郝肖肖

curl code

@@ -212,10 +212,9 @@ class Yohobuy @@ -212,10 +212,9 @@ class Yohobuy
212 } 212 }
213 213
214 $result = curl_exec($ch); 214 $result = curl_exec($ch);
215 - $httpCode = curl_getinfo($ch,CURLINFO_HTTP_CODE);  
216 215
217 //如果分流执行失败,则走原来的逻辑 216 //如果分流执行失败,则走原来的逻辑
218 - if (USE_INTER_FACE_SHUNT && $httpCode !== 200) { 217 + if (USE_INTER_FACE_SHUNT && curl_getinfo($ch,CURLINFO_HTTP_CODE) !== 200) {
219 curl_close($ch); 218 curl_close($ch);
220 return self::_get($urlBack, $data, $cache, $returnJson, $timeout, $userAgent, $useGzip); 219 return self::_get($urlBack, $data, $cache, $returnJson, $timeout, $userAgent, $useGzip);
221 } 220 }
@@ -279,7 +278,6 @@ class Yohobuy @@ -279,7 +278,6 @@ class Yohobuy
279 UdpLog::debug('call api: ', $url); 278 UdpLog::debug('call api: ', $url);
280 279
281 $result = curl_exec($ch); 280 $result = curl_exec($ch);
282 - $httpCode = curl_getinfo($ch,CURLINFO_HTTP_CODE);  
283 if (!$returnJson && !empty($result)) { 281 if (!$returnJson && !empty($result)) {
284 $result = json_decode($result, true); 282 $result = json_decode($result, true);
285 } 283 }
@@ -372,12 +370,8 @@ class Yohobuy @@ -372,12 +370,8 @@ class Yohobuy
372 } 370 }
373 $result = curl_exec($ch); 371 $result = curl_exec($ch);
374 372
375 - $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);  
376 -  
377 - UdpLog::debug('post api', array('url' => $url, 'httpCode' => $httpCode));  
378 -  
379 //如果分流执行失败,则走原来的逻辑 373 //如果分流执行失败,则走原来的逻辑
380 - if (USE_INTER_FACE_SHUNT && $httpCode !== 200) { 374 + if (USE_INTER_FACE_SHUNT && curl_getinfo($ch, CURLINFO_HTTP_CODE) !== 200) {
381 curl_close($ch); 375 curl_close($ch);
382 return self::_post($urlBack, $data, $returnJson, $timeout, $header, $cookie); 376 return self::_post($urlBack, $data, $returnJson, $timeout, $header, $cookie);
383 } 377 }