From f06c970628ab9e33641e51d3b1ff13bab013b30e Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 23 Jan 2022 20:23:40 +0000 Subject: port z_curl_error() from zap --- include/network.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include/network.php') diff --git a/include/network.php b/include/network.php index 1b8f0e663..64605749d 100644 --- a/include/network.php +++ b/include/network.php @@ -400,6 +400,18 @@ function z_post_url($url, $params, $redirects = 0, $opts = array()) { return($ret); } +function z_curl_error($ret) { + $output = EMPTY_STR; + if (isset($ret['debug'])) { + $output .= datetime_convert() . EOL; + $output .= t('url: ') . $ret['debug']['url'] . EOL; + $output .= t('error_code: ') . $ret['debug']['error_code'] . EOL; + $output .= t('error_string: ') . $ret['error'] . EOL; + $output .= t('content-type: ') . $ret['debug']['content_type'] . EOL; + } + return $output; +} + function json_return_and_die($x, $content_type = 'application/json') { header("Content-type: $content_type"); echo json_encode($x); -- cgit v1.2.3