Changeset 536 for trunk/Modules/FinanceBankAPI/FioAPI.php
- Timestamp:
- May 18, 2013, 6:51:10 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/FinanceBankAPI/FioAPI.php
r500 r536 20 20 21 21 // URL format: https://www.fio.cz/ib_api/rest/periods/{token}/{datum od}/{datum do}/transactions.{format} 22 echo('1'); 22 23 $fp = fsockopen('ssl://www.fio.cz', 443, $errno, $errstr, 30); 24 echo('2'); 23 25 if(!$fp) 24 26 { … … 37 39 38 40 // Read response 41 echo('3'); 39 42 $Response = array(); 40 43 while(!feof($fp)) 41 44 $Response .= trim(fgets($fp, 1024))."\n"; 42 45 fclose($fp); 46 echo('4'); 43 47 $Response = iconv('windows-1250', $this->Encoding, $Response); 44 48 $Response = explode("\n", $Response); … … 54 58 foreach($Response as $Index => $Line) 55 59 { 56 60 if(($Index == 0) and (substr($Line, 0, strlen(GPC_TYPE_REPORT)) != GPC_TYPE_REPORT)) $this->NoValidDataError($Response); 57 61 $GPCLine = $GPC->ParseLine($Line); 58 62 if($GPCLine != NULL) $Result[] = $GPCLine; … … 66 70 // Try to get error message 67 71 // If something go wrong fio show HTML login page and display error message 68 72 $Response = implode('', $Response); 69 73 $ErrorMessageStart = '<div id="oldform_warning">'; 70 74 if(strpos($Response, $ErrorMessageStart) !== false) 71 72 73 74 75 75 { 76 $Response = substr($Response, strpos($Response, $ErrorMessageStart) + strlen($ErrorMessageStart)); 77 $ErrorMessage = trim(substr($Response, 0, strpos($Response, '</div>'))); 78 } else $ErrorMessage = ''; 79 throw new Exception('No valid GPC data: '.$ErrorMessage); 76 80 } 77 81 }
Note:
See TracChangeset
for help on using the changeset viewer.