Debil NA
Debil NA
php
$post = file_get_contents('php://input');
$params = json_decode($post, true);
// print_r($params);
// die();
// $client = new
SoapClient('https://webservices.nbs.rs/CommunicationOfficeService1_0/
CoreXmlService.asmx?wsdl',array("trace"=>1));
// var_dump($client->__getFunctions());
// var_dump($client->__getTypes());
// die();
// echo $client->__getLastRequest();
// print_r($response);
try{
$client = new
SoapClient('https://webservices.nbs.rs/CommunicationOfficeService1_0/
CoreXmlService.asmx?wsdl',array("trace"=>1));
$auth = array(
'UserName' => 'erpbook',
'Password' => 'Ts7Yot0f21',
'LicenceID' => 'afdc17a9-a13b-40ff-a312-7f657692fb00'
);
$header = new
SoapHeader('http://communicationoffice.nbs.rs','AuthenticationHeader',$auth);
$client->__setSoapHeaders($header);
// $params = array("name"=>"elas");
$response = $client->__soapCall("GetCompany", array($params));
// $response = $client->__soapCall("GetCurrencyConvertible", array($params));
// $response = $client->GetRegion($params);
// echo $client->__getLastRequest();
// print_r($response);
// var_dump($response);
$data = $response->GetCompanyResult;
// $data = $response->GetCurrencyConvertibleResult;
$xml = simplexml_load_string($data);
$arr = json_encode($xml);
print_r($arr);
// $companies = [];
// foreach ($xml->Company as $value){
// array_push($companies, $value);
// }
// print_r($companies);
if (array_key_exists('name', $params)) {
// Zamenjuje vrednost ključa 'name' sa 'companyName'
$params['companyName'] = $params['name'];
// Uklanja ključ 'name' iz niza
unset($params['name']);
}
// Drugi SOAP poziv za dobijanje informacija o bankama
$client = new
SoapClient('https://webservices.nbs.rs/CommunicationOfficeService1_0/
CompanyAccountService.asmx?wsdl', array("trace" => 1));
$auth = array(
'UserName' => 'erpbook',
'Password' => 'Ts7Yot0f21',
'LicenceID' => 'afdc17a9-a13b-40ff-a312-7f657692fb00'
);
$header = new SoapHeader('http://communicationoffice.nbs.rs',
'AuthenticationHeader', $auth);
$client->__setSoapHeaders($header);
try{
$client = new
SoapClient('https://webservices.nbs.rs/CommunicationOfficeService1_0/
CurrentExchangeRateXmlService.asmx?WSDL',array("trace"=>1));
// var_dump($client->__getFunctions());
// var_dump($client->__getTypes());
// die();
$auth = array(
'UserName' => 'erpbook',
'Password' => 'Ts7Yot0f21',
'LicenceID' => 'afdc17a9-a13b-40ff-a312-7f657692fb00'
);
$header = new
SoapHeader('http://communicationoffice.nbs.rs','AuthenticationHeader',$auth);
$client->__setSoapHeaders($header);
$params = array("exchangeRateListTypeID"=>"3");
// $response = $client->__soapCall("GetCompany", array($params));
$response = $client->__soapCall("GetCurrentExchangeRate", array($params));
// $response = $client->GetRegion($params);
// echo $client->__getLastRequest();
// print_r($response);
// var_dump($response);
// $data = $response->GetCompanyResult;
$data = $response->GetCurrentExchangeRateResult;
$xml = simplexml_load_string($data);
$arr = json_encode($xml);
print_r($arr);
// $companies = [];
// foreach ($xml->Company as $value){
// array_push($companies, $value);
// }
// print_r($companies);
}catch(Exception $e){
var_dump($e->getMessage());
}
die();
// catch(SoapFault $fault){
// echo $client->__getLastRequest()."<br>".$fault->getMessage();
// }
?>
novine radi
<?php
$post = file_get_contents('php://input');
$params = json_decode($post, true);
// print_r($params);
// die();
// $client = new
SoapClient('https://webservices.nbs.rs/CommunicationOfficeService1_0/
CoreXmlService.asmx?wsdl',array("trace"=>1));
// var_dump($client->__getFunctions());
// var_dump($client->__getTypes());
// die();
// echo $client->__getLastRequest();
// print_r($response);
try{
$client = new
SoapClient('https://webservices.nbs.rs/CommunicationOfficeService1_0/
CoreXmlService.asmx?wsdl',array("trace"=>1));
$auth = array(
'UserName' => 'erpbook',
'Password' => 'Ts7Yot0f21',
'LicenceID' => 'afdc17a9-a13b-40ff-a312-7f657692fb00'
);
$header = new
SoapHeader('http://communicationoffice.nbs.rs','AuthenticationHeader',$auth);
$client->__setSoapHeaders($header);
// $params = array("name"=>"elas");
$response = $client->__soapCall("GetCompany", array($params));
// $response = $client->__soapCall("GetCurrencyConvertible", array($params));
// $response = $client->GetRegion($params);
// echo $client->__getLastRequest();
// print_r($response);
// var_dump($response);
$data = $response->GetCompanyResult;
// $data = $response->GetCurrencyConvertibleResult;
$xml = simplexml_load_string($data);
$arr = json_encode($xml);
//print_r($arr);
// $companies = [];
// foreach ($xml->Company as $value){
// array_push($companies, $value);
// }
if (array_key_exists('name', $params)) {
// Zamenjuje vrednost ključa 'name' sa 'companyName'
$params['companyName'] = $params['name'];
// Uklanja ključ 'name' iz niza
unset($params['name']);
}
// Drugi SOAP poziv za dobijanje informacija o bankama
$client = new
SoapClient('https://webservices.nbs.rs/CommunicationOfficeService1_0/
CompanyAccountService.asmx?wsdl', array("trace" => 1));
$auth = array(
'UserName' => 'erpbook',
'Password' => 'Ts7Yot0f21',
'LicenceID' => 'afdc17a9-a13b-40ff-a312-7f657692fb00'
);
$header = new SoapHeader('http://communicationoffice.nbs.rs',
'AuthenticationHeader', $auth);
$client->__setSoapHeaders($header);
$accountNumbers = [];
if (isset($banksData['CompanyAccountDataSet']['CompanyAccount'])) {
foreach ($banksData['CompanyAccountDataSet']['CompanyAccount'] as $account)
{
$accountNumbers[] = $account['Account'];
}
}
// Pretvoriti brojeve računa u string
$accountsString = implode(', ', $accountNumbers);
// Konvertujte SimpleXMLElement u PHP niz
// Pretvori SimpleXMLElement u PHP niz
$xmlArray = json_decode(json_encode($xml), true);
try{
$client = new
SoapClient('https://webservices.nbs.rs/CommunicationOfficeService1_0/
CurrentExchangeRateXmlService.asmx?WSDL',array("trace"=>1));
// var_dump($client->__getFunctions());
// var_dump($client->__getTypes());
// die();
$auth = array(
'UserName' => 'erpbook',
'Password' => 'Ts7Yot0f21',
'LicenceID' => 'afdc17a9-a13b-40ff-a312-7f657692fb00'
);
$header = new
SoapHeader('http://communicationoffice.nbs.rs','AuthenticationHeader',$auth);
$client->__setSoapHeaders($header);
$params = array("exchangeRateListTypeID"=>"3");
// $response = $client->__soapCall("GetCompany", array($params));
$response = $client->__soapCall("GetCurrentExchangeRate", array($params));
// $response = $client->GetRegion($params);
// echo $client->__getLastRequest();
// print_r($response);
// var_dump($response);
// $data = $response->GetCompanyResult;
$data = $response->GetCurrentExchangeRateResult;
$xml = simplexml_load_string($data);
$arr = json_encode($xml);
print_r($arr);
// $companies = [];
// foreach ($xml->Company as $value){
// array_push($companies, $value);
// }
// print_r($companies);
}catch(Exception $e){
var_dump($e->getMessage());
}
die();
// catch(SoapFault $fault){
// echo $client->__getLastRequest()."<br>".$fault->getMessage();
// }
?>