Ignore:
Timestamp:
Oct 2, 2019, 12:15:16 AM (5 years ago)
Author:
chronos
Message:
  • Modified: Optimized netwatch inport for inserting data ti database.
  • Fixed: RouterOS API to work with RouterOS newer than 6.43.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/NetworkConfigRouterOS/RouterboardAPI.php

    r738 r861  
    5454    {
    5555      socket_set_timeout($this->Socket, $this->Timeout);
    56       $this->Write('/login');
     56      $this->Write('/login', false);
     57      $this->Write('=name=' . $Login, false);
     58      $this->Write('=password='.$Password);
    5759      $Response = $this->Read(false);
    58       if ((count($Response) > 1) and ($Response[0] == '!done')) {
    59         if (preg_match_all('/[^=]+/i', $Response[1], $Matches)) {
    60           if ($Matches[0][0] == 'ret' && strlen($Matches[0][1]) == 32) {
    61             $this->Write('/login', false);
    62             $this->Write('=name=' . $Login, false);
    63             $this->Write('=response=00'.md5(chr(0).$Password.pack('H*', $Matches[0][1])));
    64             $Response = $this->Read(false);
    65             if((count($Response) > 0) and ($Response[0] == '!done')) $this->Connected = true;
    66           }
    67         }
    68       }
     60      if((count($Response) > 0) and ($Response[0] == '!done')) $this->Connected = true;
    6961      if(!$this->Connected) fclose($this->Socket);
    7062    }
Note: See TracChangeset for help on using the changeset viewer.