📜  php curl 详细失败 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:41.746000             🧑  作者: Mango

代码示例1
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
\n", curl_errno($handle), htmlspecialchars(curl_error($handle))); } rewind($verbose); $verboseLog = stream_get_contents($verbose); echo "Verbose information:\n
", htmlspecialchars($verboseLog), "
\n";