Changeset 873 for trunk/Modules/FinanceBankAPI/Fio.php
- Timestamp:
- Apr 6, 2020, 11:17:40 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/FinanceBankAPI/Fio.php
r738 r873 11 11 function Import($TimeFrom, $TimeTo) 12 12 { 13 if ($this->UserName == '') throw new Exception('Missing value for UserName property.');14 if ($this->Password == '') throw new Exception('Missing value for Password property.');15 if (!is_numeric($this->Account)) throw new Exception('Missing or not numeric value for Account property.');13 if ($this->UserName == '') throw new Exception('Missing value for UserName property.'); 14 if ($this->Password == '') throw new Exception('Missing value for Password property.'); 15 if (!is_numeric($this->Account)) throw new Exception('Missing or not numeric value for Account property.'); 16 16 17 17 $fp = fsockopen('ssl://www.fio.cz', 443, $errno, $errstr, 30); 18 if (!$fp)18 if (!$fp) 19 19 { 20 20 throw new Exception('Connection error: '.$errstr); … … 35 35 // Read response 36 36 $Response = array(); 37 while (!feof($fp))37 while (!feof($fp)) 38 38 { 39 39 $Response[] = trim(fgets($fp, 1024)); … … 42 42 43 43 // Strip HTTP header 44 while ($Response[0] != '') array_shift($Response);44 while ($Response[0] != '') array_shift($Response); 45 45 array_shift($Response); // Remove empty line 46 46 //echo(implode("\n", $Response)); … … 49 49 $GPC = new GPC(); 50 50 $Result = array(); 51 foreach ($Response as $Index => $Line)51 foreach ($Response as $Index => $Line) 52 52 { 53 if (($Index == 0) and (substr($Line, 0, strlen(GPC_TYPE_REPORT)) != GPC_TYPE_REPORT)) $this->NoValidDataError($Response);53 if (($Index == 0) and (substr($Line, 0, strlen(GPC_TYPE_REPORT)) != GPC_TYPE_REPORT)) $this->NoValidDataError($Response); 54 54 $GPCLine = $GPC->ParseLine($Line); 55 if ($GPCLine != NULL) $Result[] = $GPCLine;55 if ($GPCLine != NULL) $Result[] = $GPCLine; 56 56 } 57 return ($Result);57 return ($Result); 58 58 } 59 59 } … … 65 65 $Response = implode('', $Response); 66 66 $ErrorMessageStart = '<div id="oldform_warning">'; 67 if (strpos($Response, $ErrorMessageStart) !== false)67 if (strpos($Response, $ErrorMessageStart) !== false) 68 68 { 69 69 $Response = substr($Response, strpos($Response, $ErrorMessageStart) + strlen($ErrorMessageStart));
Note:
See TracChangeset
for help on using the changeset viewer.