diff options
author | Andrew Manning <tamanning@zoho.com> | 2016-06-17 06:36:09 -0400 |
---|---|---|
committer | Andrew Manning <tamanning@zoho.com> | 2016-06-17 06:36:09 -0400 |
commit | 80d3a831f377820ef7b816129ad333a756a4a704 (patch) | |
tree | 21830d7f863a29f4c01b4b1be2e43f66767d1f4a /include/network.php | |
parent | 961539258be90f5b7c989299db0e8c551d0d6c72 (diff) | |
parent | aa5ac9dc3fb81bdc8aa17567eed42e845c408d00 (diff) | |
download | volse-hubzilla-80d3a831f377820ef7b816129ad333a756a4a704.tar.gz volse-hubzilla-80d3a831f377820ef7b816129ad333a756a4a704.tar.bz2 volse-hubzilla-80d3a831f377820ef7b816129ad333a756a4a704.zip |
Merge remote-tracking branch 'upstream/dev' into wiki
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)); |