3 回答
TA贡献1946条经验 获得超4个赞
CURLOPT_VERBOSE
curl_setopt($curlhandle, CURLOPT_VERBOSE, true);
CURLOPT_VERBOSE
CURLOPT_STDERR
TA贡献1784条经验 获得超8个赞
CURLOPT_VERBOSE
CURLOPT_STDERR
:
// CURLOPT_VERBOSE: TRUE to output verbose information. Writes output to STDERR, // or the file specified using CURLOPT_STDERR.curl_setopt($handle, CURLOPT_VERBOSE, true); $verbose = fopen('php://temp', 'w+');curl_setopt($handle, CURLOPT_STDERR, $verbose);
$result = curl_exec($handle);if ($result === FALSE) { printf("cUrl error (#%d): %s<br>\n", curl_errno($handle), htmlspecialchars(curl_error($handle)));}rewind($verbose);$verboseLog = stream_get_contents($verbose);echo "Verbose information: \n<pre>", htmlspecialchars($verboseLog), "</pre>\n";
curl_getinfo
$version = curl_version();
extract(curl_getinfo($handle));
$metrics = <<<EOD
URL....: $url
Code...: $http_code ($redirect_count redirect(s) in $redirect_time secs)
Content: $content_type Size: $download_content_length (Own: $size_download) Filetime: $filetime
Time...: $total_time Start @ $starttransfer_time (DNS: $namelookup_time Connect: $connect_time Request: $pretransfer_time)
Speed..: Down: $speed_download (avg.) Up: $speed_upload (avg.)
Curl...: v{$version['version']}
EOD;
- 3 回答
- 0 关注
- 994 浏览
添加回答
举报