Linux kann ich einigermaßen
Soso.
mit curl sehe ich zwar, was da so passiert, aber leider keine Zeiträume zwischen den Aktionen.
man curl
zu lesen gehört zu „Linux kann ich“. Und es verhilft zu einer einfachen Lösung
Datei: ./curl_outs
time_namelookup:%{time_namelookup}\n
time_pretransfer:%{time_pretransfer}\n
time_redirect:%{time_redirect}\n
time_redirect:%{time_total}\n
Die Liste der (relevanten) Variablen:
-
time_appconnect: The time, in seconds, it took from the start untilthe SSL/SSH/etc connect/handshake to the remote host was completed. (Added in 7.19.0)
-
time_connect: The time, in seconds, it took from the start until the TCP connect to the remote host (or proxy) was completed.
-
time_namelookup: The time, in seconds, it took from the start until the name resolving was completed.
-
time_pretransfer: The time, in seconds, it took from the start until the file transfer was just about to begin. This includes all pre-transfer commands and negotiations that are specific to the particular protocol(s) involved.
-
time_redirect: The time, in seconds, it took for all redirection steps including name lookup, connect, pretransfer and transfer before the final transaction wasstarted. time_redirect shows the complete execution time for multiple redirections. (Added in 7.12.3)
-
time_starttransfer The time, in seconds, it took from the start until the first byte was just about to be transferred. This includes time_pretransfer and also the time the server needed to calculate the result.
-
time_total: The total time, in seconds, that the full operation lasted.
LANG=C curl -I --write-out @./curl_outs https://www.example.com 2> /dev/null | grep -P '^time_'
Den Befehl, und die URL sicher in PHP einbetten kannst Du?
$sys = 'LANG=C curl -I --write-out @./curl_outs '
. ecsapeshellarg( $URL )
. ' 2> /dev/null | grep -P \'^time_\';'
;
(Das hab ich „blind“ geschrieben.)
Jetzt musst Du nur noch die Ausgaben auswerten...