PHP Classes

SSL

Recommend this page to a friend!

      WebDAV client  >  All threads  >  SSL  >  (Un) Subscribe thread alerts  
Subject:SSL
Summary:SSL support to this class
Messages:1
Author:albaaaa
Date:2011-06-24 15:22:48
 

 


  1. SSL   Reply   Report abuse  
Picture of albaaaa albaaaa - 2011-06-24 15:22:48
hey... i needed a ssl connection, this is how to add it (it's quite simple)

1- Add openSSL to your php configuration:
open php.ini
uncomment "extension=php_openssl.dll"
restart PHP

2- modify the class:
a- in variables definition, add
var $_ssl = '';

b- function creation:
<code>
function set_ssl($ssl) {
if ($ssl == 1) {
$this->_ssl = 'ssl://';
} else {
$this->_ssl = '';
}
$this->_error_log('SSL extention was set to ' . $this->_ssl);
}
</code>

c- in "open function"
replace the fsockopen line by:
$this->_fp = fsockopen ($this->_ssl . $this->_server, $this->_port, $this->_errno, $this->_errstr, $this->_socket_timeout);


3- Modify your program:
a- set port to 443 (or any user port you use)
b- add $wdc->set_ssl(1);

now i've written this, i realise code modification is not mandatory: once ssl is supported, juste use $wdc->set_server('ssl://yourserveur'); and modify port ...

I think my code could be used to handle redirection messages and change to SSL when needed ...