Adding verbosity for cURL (#697)
Added code to increase cURL verbosity in cases where PSM_DEBUG is defined and set to a value of boolean TRUE only if the request is coming via CLI.pull/662/head^2
parent
6761776a8f
commit
8f43fd99e6
|
@ -357,6 +357,9 @@ function psm_curl_get($href, $header = false, $body = true, $timeout = null, $ad
|
||||||
$timeout = $timeout == null ? PSM_CURL_TIMEOUT : intval($timeout);
|
$timeout = $timeout == null ? PSM_CURL_TIMEOUT : intval($timeout);
|
||||||
|
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
|
if(defined('PSM_DEBUG') && PSM_DEBUG === true && psm_is_cli()) {
|
||||||
|
curl_setopt($ch, CURLOPT_VERBOSE, true);
|
||||||
|
}
|
||||||
curl_setopt($ch, CURLOPT_HEADER, $header);
|
curl_setopt($ch, CURLOPT_HEADER, $header);
|
||||||
curl_setopt($ch, CURLOPT_NOBODY, (!$body));
|
curl_setopt($ch, CURLOPT_NOBODY, (!$body));
|
||||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
||||||
|
@ -397,6 +400,12 @@ function psm_curl_get($href, $header = false, $body = true, $timeout = null, $ad
|
||||||
|
|
||||||
$result = curl_exec($ch);
|
$result = curl_exec($ch);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
|
if(defined('PSM_DEBUG') && PSM_DEBUG === true && psm_is_cli()) {
|
||||||
|
echo PHP_EOL.'==============cURL Result for: '.$href.'==========================================='.PHP_EOL;
|
||||||
|
print_r($result);
|
||||||
|
echo PHP_EOL.'==============END cURL Resul for: '.$href.'==========================================='.PHP_EOL;
|
||||||
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue