CURL php返回错误的STARTTRANSFER时间

时间:2018-04-13 07:17:16

标签: php curl xampp

SYSTEM:Win10教授, XAMPP版本:7.1.10

我目前正在通过curl向rest API发送请求。在curl_exec()之后,我想检查curl请求的运行时间。

当检查时间返回时,curl_getinfo大部分时间值都是正确的,但有时STARTTRANSFER会返回远离实时响应的时间。

示例正常:

|<br>
 |--NAMELOOKUP 0.015 (Time from start until name resolving completed)<br>
 |--|--CONNECT 0.015 (Time from start until remote host or proxy completed) 
 <br>
 |--|--|--APPCONNECT 0.046 (Time from start until SSL/SSH handshake completed)<br>
  |--|--|--|--PRETRANSFER 0.046 (Time from start until just before the transfer begins)<br>
   |--|--|--|--|--STARTTRANSFER 1.203 (Time from start until just when the first byte is received)<br>
   |--|--|--|--|--|--TOTAL 1.203 (Total time of previous transfer)<br>
   |--|--|--|--|--|--REDIRECT 0 (Time taken for all redirect steps before the final transfer)<br>

   |<br>
   |--NAMELOOKUP 0.031 (Time from start until name resolving completed)<br>
   |--|--CONNECT 0.031 (Time from start until remote host or proxy completed)<br>
   |--|--|--APPCONNECT 0.078 (Time from start until SSL/SSH handshake completed) 
        <br>
    |--|--|--|--PRETRANSFER 0.078 (Time from start until just before the transfer begins)<br>
     |--|--|--|--|--STARTTRANSFER 0.75 (Time from start until just when the first byte is received)<br>
     |--|--|--|--|--|--TOTAL 0.75 (Total time of previous transfer)<br>
    |--|--|--|--|--|--REDIRECT 0 (Time taken for all redirect steps before the final transfer)<br> 

有时候这种回应:

    |--NAMELOOKUP 0.031 (Time from start until name resolving completed)<br>
    |--|--CONNECT 0.031 (Time from start until remote host or proxy completed)<br>
   |--|--|--APPCONNECT 0.078 (Time from start until SSL/SSH handshake completed)<br>
   |--|--|--|--PRETRANSFER 0.078 (Time from start until just before the transfer begins)<br>
   |--|--|--|--|--STARTTRANSFER 4298.732296 (Time from start until just when the first byte is received)<br>
   |--|--|--|--|--|--TOTAL 4298.732296 (Total time of previous transfer)<br>
   |--|--|--|--|--|--REDIRECT 0 (Time taken for all redirect steps before the final transfer)<br>

处理时间始终在加载页面的1-2秒内,以便打印响应。

只有在Windows计算机上的xampp中启动脚本时才会出现此问题。在linux(debian)系统上运行时,它不会发生。

此时有任何想法在使用curl和xampp的窗口上出现了什么问题吗?

0 个答案:

没有答案