Skip to content

Commit

Permalink
Merge pull request #5 from afornerot/master
Browse files Browse the repository at this point in the history
add a host_proxy option
  • Loading branch information
carduz authored Apr 25, 2019
2 parents 981ba1c + e70e145 commit dae70da
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion example code/example.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@
* setCalendar()
*/

$client->connect('http://yourServer/baikal/cal.php/calendars/yourUser/yourCalendar', 'username', 'password');
$client->connect('http://yourServer/baikal/cal.php/calendars/yourUser/yourCalendar', 'username', 'password');
/* With proxy
$client->connect('http://yourServer/baikal/cal.php/calendars/yourUser/yourCalendar', 'username', 'password', ['proxy_host'=>'http://myproxyip:myproxyport']);
*/


$arrayOfCalendars = $client->findCalendars(); // Returns an array of all accessible calendars on the server.

Expand Down
5 changes: 5 additions & 0 deletions src/CalDAVClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ function __construct( $base_url, $user, $pass, $options = array()) {
CURLOPT_SSL_VERIFYPEER => FALSE
));

// Define Proxy
if(isset($options['proxy_host'])) {
curl_setopt($this->ch, CURLOPT_PROXY, $options['proxy_host']);
}

$this->full_url = $base_url;
$this->first_url_part = $matches[1];
}
Expand Down
4 changes: 2 additions & 2 deletions src/SimpleCalDAVClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ class SimpleCalDAVClient {
* @throws CalDAVException
* For debugging purposes, just sorround everything with try { ... } catch (Exception $e) { echo $e->__toString(); }
*/
function connect ( $url, $user, $pass )
function connect ( $url, $user, $pass, $options=[] )
{

// Connect to CalDAV-Server and log in
$client = new CalDAVClient($url, $user, $pass);
$client = new CalDAVClient($url, $user, $pass, $options);

// Valid CalDAV-Server? Or is it just a WebDAV-Server?
if( ! $client->isValidCalDAVServer() )
Expand Down

0 comments on commit dae70da

Please sign in to comment.