Thứ Sáu, 8 tháng 3, 2013

Server download speed using PHP cURL


Trong đó curl_getinfo ( resource $ch [, int $opt = 0 ] ) dùng để lấy thấy thông tin từ lượt chuyển dữ liệu xác định.Đây là các option trả lại của nó:
If opt is given, returns its value as a string. Otherwise, returns an associative array with the following elements (which correspond to opt), or FALSE on failure:
"url"
"content_type"
"http_code"
"header_size"
"request_size"
"filetime"
"ssl_verify_result"
"redirect_count"
"total_time"
"namelookup_time"
"connect_time"
"pretransfer_time"
"size_upload"
"size_download"
"speed_download"
"speed_upload"
"download_content_length"
"upload_content_length"
"starttransfer_time"
"redirect_time"
"certinfo"
"request_header"



Thời gian thực thi request chính là thời gian download.Kết quả là:


Downloaded 6576848 bytes in 16.2153 seconds.
Which is 3.0944 mbps
CURL said 3.0755 mbps


curl_getinfo() said:
---------------------------------------------------------------------------------------------
url http://download.bethere.co.uk/images/61859740_3c0c5dbc30_o.jpg
content_type image/jpeg
http_code 200
header_size 263
request_size 198
filetime -1
ssl_verify_result 0
redirect_count 0
total_time 16.314966
namelookup_time 0.000287
connect_time 0.021524
pretransfer_time 0.021595
size_upload 0
size_download 6576848
speed_download 403117
speed_upload 0
download_content_length 6576848
upload_content_length 0
starttransfer_time 0.056275
redirect_time 0

Không có nhận xét nào:

Đăng nhận xét