aboutsummaryrefslogtreecommitdiffstats
path: root/include/network.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-01-23 20:23:40 +0000
committerMario <mario@mariovavti.com>2022-01-23 20:23:40 +0000
commitf06c970628ab9e33641e51d3b1ff13bab013b30e (patch)
treeeb9f3d2cc26f79ddfcccebadfa2db11b5b4b175d /include/network.php
parent99bce46b323e6cbc4f858280cd37aa2ed5506e7d (diff)
downloadvolse-hubzilla-f06c970628ab9e33641e51d3b1ff13bab013b30e.tar.gz
volse-hubzilla-f06c970628ab9e33641e51d3b1ff13bab013b30e.tar.bz2
volse-hubzilla-f06c970628ab9e33641e51d3b1ff13bab013b30e.zip
port z_curl_error() from zap
Diffstat (limited to 'include/network.php')
-rw-r--r--include/network.php12
1 files changed, 12 insertions, 0 deletions
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);