Skip to content

Commit

Permalink
Merge pull request #19 from eduardomazolini/patch-1
Browse files Browse the repository at this point in the history
API-SSL without certificate
  • Loading branch information
BenMenking authored Oct 18, 2016
2 parents 75c0fd7 + 59a3494 commit a9ae96c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion routeros_api.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ public function connect($ip, $login, $password)
for ($ATTEMPT = 1; $ATTEMPT <= $this->attempts; $ATTEMPT++) {
$this->connected = false;
$PROTOCOL = ($this->ssl ? 'ssl://' : '' );
$context = stream_context_create(array('ssl' => array('ciphers' => 'ADH:ALL', 'verify_peer' => false, 'verify_peer_name' => false)));
$this->debug('Connection attempt #' . $ATTEMPT . ' to ' . $PROTOCOL . $ip . ':' . $this->port . '...');
$this->socket = @fsockopen($PROTOCOL . $ip, $this->port, $this->error_no, $this->error_str, $this->timeout);
$this->socket = @stream_socket_client($PROTOCOL . $ip.':'. $this->port, $this->error_no, $this->error_str, $this->timeout, STREAM_CLIENT_CONNECT,$context);
if ($this->socket) {
socket_set_timeout($this->socket, $this->timeout);
$this->write('/login');
Expand Down

0 comments on commit a9ae96c

Please sign in to comment.