Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @param houses $accountId
- * @param $access_token
- * @return mixed
- */
- protected function getTochkaAccountId($access_token, $accountId, $dateArr = [])
- {
- if(count($dateArr) == 0) {
- $dateArr['start_date'] = '2014-01-01T00:00:00+03:00';
- $dateArr['end_date'] = '2020-12-01T00:00:00+03:00';
- }
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, "https://api.tochka.com/ws/do/R0100");
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
- curl_setopt($ch, CURLOPT_HEADER, FALSE);
- curl_setopt($ch, CURLOPT_POST, TRUE);
- curl_setopt($ch, CURLOPT_POSTFIELDS, "<message_v1 xmlns=\"http://www.anr.ru/types\" type=\"request\">
- <data trn_code=\"R0100\">
- <statement_request_v1 xmlns=\"http://www.anr.ru/types\"
- account_id=\"" . $accountId . "\"
- account_bic=\"000000000\"
- start_date=\"" . $dateArr['start_date'] . "\"
- end_date=\"" . $dateArr['end_date'] . "\"></statement_request_v1>
- </data>
- </message_v1>");
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
- "Content-Type: application/xml",
- "Authorization: Bearer " . $access_token,
- "Accept: application/xml;"
- ));
- $response = curl_exec($ch);
- curl_close($ch);
- $xmlTochkaId = new \SimpleXMLElement($response);
- foreach ($xmlTochkaId->attributes() as $nameAttr => $valAttr) {
- if ((string) $nameAttr == 'int_id') {
- $int_id = (string) $valAttr;
- }
- }
- return $int_id;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement