aboutsummaryrefslogtreecommitdiffstats
path: root/include/network.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-02-27 23:48:54 -0800
committerzotlabs <mike@macgirvin.com>2017-02-27 23:48:54 -0800
commitfa944fc52646219d69f910d7cd4750db9c8f11bd (patch)
tree9ab795eb36984efdad25b1f27bc5c0c9650513e0 /include/network.php
parentdf6e75e1d6eede898e663cc63b346f118767aba5 (diff)
downloadvolse-hubzilla-fa944fc52646219d69f910d7cd4750db9c8f11bd.tar.gz
volse-hubzilla-fa944fc52646219d69f910d7cd4750db9c8f11bd.tar.bz2
volse-hubzilla-fa944fc52646219d69f910d7cd4750db9c8f11bd.zip
provide 'session' option to z_fetch_url to assist with remote fetches requiring magic auth
Diffstat (limited to 'include/network.php')
-rw-r--r--include/network.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/network.php b/include/network.php
index 66716ef9e..0fda80f19 100644
--- a/include/network.php
+++ b/include/network.php
@@ -91,6 +91,10 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) {
@curl_setopt($ch, CURLOPT_TIMEOUT, (($curl_time !== false) ? $curl_time : 60));
}
+ if(x($opts,'session') && strpos($url,z_root()) === 0) {
+ @curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Cookie: PHPSESSID=' . session_id() ]);
+ }
+
if(x($opts,'http_auth')) {
// "username" . ':' . "password"
@curl_setopt($ch, CURLOPT_USERPWD, $opts['http_auth']);