0% found this document useful (0 votes)
17 views7 pages

Debil NA

Uploaded by

boskorin823
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views7 pages

Debil NA

Uploaded by

boskorin823
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 7

<?

php

$post = file_get_contents('php://input');
$params = json_decode($post, true);

// print_r($params);
// die();

// $client = new SoapClient('ndfdXML.wsdl');


// $client = new SoapClient('http://www.dneonline.com/calculator.asmx?
wsdl',array("trace"=>1));
// var_dump($client->__getFunctions());
// var_dump($client->__getTypes());
// $auth = array(
// 'UserName' => 'erpbook',
// 'Password' => 'Ts7Yot0f21',
// 'LicenceID' => 'afdc17a9-a13b-40ff-a312-7f657692fb00'
// );
// $header = new
SoapHeader('http://communicationoffice.nbs.rs','AuthenticationHeader',array($auth))
;
// $client->__setSoapHeaders($header);
// $response = $client->Add(array("intA"=>8,"intB"=>10));
// print_r($response);
// echo $client->__getLastRequest();
// die();
// ,array(
// 'UserName' => 'erpbook',
// 'Password' => 'Ts7Yot0f21',
// 'LicenceID' => 'afdc17a9-a13b-40ff-a312-7f657692fb00'
// )

// $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);

$response = $client->__soapCall("GetCompanyAccount", array($params));


$data = $response->GetCompanyAccountResult->any;
$xml = simplexml_load_string($data);
$banksData = json_decode(json_encode($xml), true);

// Prikupljanje brojeva računa u niz


$accountNumbers = [];
if (isset($banksData['CompanyAccountDataSet']['CompanyAccount'])) {
foreach ($banksData['CompanyAccountDataSet']['CompanyAccount'] as $account)
{
$accountNumbers[] = $account['Account'];
}
}

// Pretvoriti niz brojeva računa u string sa zarezima


$accountsString = implode(', ', $accountNumbers);

// Dodavanje brojeva računa u 'Company' ključe kao string


if (!isset($companyData['Company'])) {
$companyData['Company'] = [];
}
$companyData['Company']['banks'] = $accountsString;

// Pretvoriti ceo JSON u string i ukloniti formatiranje


$responseData = json_encode($companyData);

// Postaviti header i ispisati tekstualni odgovor


header('Content-Type: text/plain');
//print_r ($responseData);
}catch(Exception $e){
var_dump($e->getMessage());
}
die();

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('ndfdXML.wsdl');


// $client = new SoapClient('http://www.dneonline.com/calculator.asmx?
wsdl',array("trace"=>1));
// var_dump($client->__getFunctions());
// var_dump($client->__getTypes());
// $auth = array(
// 'UserName' => 'erpbook',
// 'Password' => 'Ts7Yot0f21',
// 'LicenceID' => 'afdc17a9-a13b-40ff-a312-7f657692fb00'
// );
// $header = new
SoapHeader('http://communicationoffice.nbs.rs','AuthenticationHeader',array($auth))
;
// $client->__setSoapHeaders($header);
// $response = $client->Add(array("intA"=>8,"intB"=>10));
// print_r($response);
// echo $client->__getLastRequest();
// die();
// ,array(
// 'UserName' => 'erpbook',
// 'Password' => 'Ts7Yot0f21',
// 'LicenceID' => 'afdc17a9-a13b-40ff-a312-7f657692fb00'
// )

// $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);

$response = $client->__soapCall("GetCompanyAccount", array($params));


$data = $response->GetCompanyAccountResult->any;
$xml1 = simplexml_load_string($data);
$banksData = json_decode(json_encode($xml1), true);

$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);

// Ako $xmlArray sadrži ključ 'Company'


if (isset($xmlArray['Company'])) {
foreach ($xmlArray['Company'] as &$company) {
// Dodaj brojeve računa pod ključ 'banks'
$company['banks'] = $accountsString;
}
}

// Enkoduj PHP niz u JSON


$responseData = json_encode($xmlArray);

// Postavi header za JSON


header('Content-Type: application/json');

// Ispiši JSON string bez dodatnih karaktera


echo $responseData;
}catch(Exception $e){
var_dump($e->getMessage());
}
die();

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();
// }

?>

You might also like