diff options
author | Mario Vavti <mario@mariovavti.com> | 2016-06-17 10:04:27 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2016-06-17 10:04:27 +0200 |
commit | 0324bc5cf0fe6a758070cdc74897836758187b30 (patch) | |
tree | c7e8fc672f83950aa61dd97b5fb0d22a108097b8 /include/network.php | |
parent | 5b479d63d62ef893360fd210947012310e8f9755 (diff) | |
parent | f6d76282549c562120417cbdd111109add4f7672 (diff) | |
download | volse-hubzilla-0324bc5cf0fe6a758070cdc74897836758187b30.tar.gz volse-hubzilla-0324bc5cf0fe6a758070cdc74897836758187b30.tar.bz2 volse-hubzilla-0324bc5cf0fe6a758070cdc74897836758187b30.zip |
Merge branch 'dev' into sabre32
Diffstat (limited to 'include/network.php')
-rw-r--r-- | include/network.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/network.php b/include/network.php index a595a03d1..d922799b6 100644 --- a/include/network.php +++ b/include/network.php @@ -29,6 +29,8 @@ function get_capath() { * * \b nobody => only return the header * * \b filep => stream resource to write body to. header and body are not returned when using this option. * * \b custom => custom request method: e.g. 'PUT', 'DELETE' + * * \b cookiejar => cookie file (write) + * * \B cookiefile => cookie file (read) * * @return array an associative array with: * * \e int \b return_code => HTTP return code or 0 if timeout or failure @@ -60,6 +62,8 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { @curl_setopt($ch, CURLOPT_HEADER, $false); } + + if(x($opts,'headers')) @curl_setopt($ch, CURLOPT_HTTPHEADER, $opts['headers']); @@ -82,6 +86,11 @@ function z_fetch_url($url, $binary = false, $redirects = 0, $opts = array()) { @curl_setopt($ch, CURLOPT_USERPWD, $opts['http_auth']); } + if(x($opts,'cookiejar')) + @curl_setopt($ch, CURLOPT_COOKIEJAR, $opts['cookiejar']); + if(x($opts,'cookiefile')) + @curl_setopt($ch, CURLOPT_COOKIEFILE, $opts['cookiefile']); + @curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, ((x($opts,'novalidate') && intval($opts['novalidate'])) ? false : true)); @@ -228,6 +237,12 @@ logger('headers: ' . print_r($opts['headers'],true) . 'redir: ' . $redirects); @curl_setopt($ch, CURLOPT_USERPWD, $opts['http_auth']); } + + if(x($opts,'cookiejar')) + @curl_setopt($ch, CURLOPT_COOKIEJAR, $opts['cookiejar']); + if(x($opts,'cookiefile')) + @curl_setopt($ch, CURLOPT_COOKIEFILE, $opts['cookiefile']); + @curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, ((x($opts,'novalidate') && intval($opts['novalidate'])) ? false : true)); |