Ignore:
Timestamp:
Apr 14, 2015, 10:20:16 PM (10 years ago)
Author:
chronos
Message:
  • Removed: Spaces on end of line.
  • Modified: Tabs converted to spaces.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/FinanceBankAPI/Fio.php

    r550 r738  
    11<?php
    2  
     2
    33include('GPC.php');
    4  
    5 class Fio 
     4
     5class Fio
    66{
    77  var $UserName;
    88  var $Password;
    9   var $Account; 
    10  
     9  var $Account;
     10
    1111  function Import($TimeFrom, $TimeTo)
    1212  {
     
    1414    if($this->Password == '') throw new Exception('Missing value for Password property.');
    1515    if(!is_numeric($this->Account)) throw new Exception('Missing or not numeric value for Account property.');
    16  
     16
    1717    $fp = fsockopen('ssl://www.fio.cz', 443, $errno, $errstr, 30);
    18     if(!$fp) 
     18    if(!$fp)
    1919    {
    2020      throw new Exception('Connection error: '.$errstr);
    21     } else 
     21    } else
    2222    {
    2323      // Send request
     
    3232      $Request .= "Connection: Close\r\n\r\n";
    3333      fwrite($fp, $Request);
    34  
     34
    3535      // Read response
    3636      $Response = array();
    37       while(!feof($fp)) 
     37      while(!feof($fp))
    3838      {
    3939        $Response[] = trim(fgets($fp, 1024));
    4040      }
    4141      fclose($fp);
    42  
     42
    4343      // Strip HTTP header
    4444      while($Response[0] != '') array_shift($Response);
    4545      array_shift($Response); // Remove empty line
    4646      //echo(implode("\n", $Response));
    47  
     47
    4848      // Parse all GPC lines
    4949      $GPC = new GPC();
     
    5858    }
    5959  }
    60  
     60
    6161  function NoValidDataError($Response)
    6262  {
    6363    // Try to get error message
    6464    // If something go wrong fio show HTML login page and display error message
    65         $Response = implode('', $Response);
     65  $Response = implode('', $Response);
    6666    $ErrorMessageStart = '<div id="oldform_warning">';
    67     if(strpos($Response, $ErrorMessageStart) !== false) 
    68         {
    69           $Response = substr($Response, strpos($Response, $ErrorMessageStart) + strlen($ErrorMessageStart));
    70           $ErrorMessage = trim(substr($Response, 0, strpos($Response, '</div>')));
    71         } else $ErrorMessage = '';
    72         throw new Exception('No valid GPC data: '.$ErrorMessage);
     67    if(strpos($Response, $ErrorMessageStart) !== false)
     68  {
     69    $Response = substr($Response, strpos($Response, $ErrorMessageStart) + strlen($ErrorMessageStart));
     70    $ErrorMessage = trim(substr($Response, 0, strpos($Response, '</div>')));
     71  } else $ErrorMessage = '';
     72  throw new Exception('No valid GPC data: '.$ErrorMessage);
    7373  }
    7474}
Note: See TracChangeset for help on using the changeset viewer.