|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
kiranupadhyak Smarty n00b
Joined: 25 May 2017 Posts: 1
|
Posted: Thu May 25, 2017 9:06 am Post subject: Regarding SoapClient |
|
|
Hi,
I have following php file inside smarty (.tpl). I want to perform API call using SoapClient inside .tpl file, How can I do that ?. Please show me one example for the same.
{php}
class Test
{
public function authenticate($api_controller, $action, $input=null)
{
$key = array(
'email' => 'abc@gmail.com',
'password' => 'passwd123',
'domain' => 'abcd.com'
);
$client = new SoapClient('https://192.70.0.2:2443/soap?wsdl');
if (!$input) {
$response = $client->route($key, $api_controller, $action);
}
else {
$response = $client->route($key, $api_controller, $action, $input);
}
return $response;
}
public function getSize()
{
$action = 'listAccountDetails';
$api_controller = '/siteworx/overview';
$response = $this->authenticate($api_controller, $action);
return $response['payload']['remaining_diskspace'];
<!-- It will return disk size ex 500MB -->
}
}
$control = new Test();
print_r($control->getSize());
{/php} |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Thu May 25, 2017 1:48 pm Post subject: |
|
|
Do not do this.
Do not include PHP code into your templates. Much less include a code that declares anything.
Do your PHP coding in your PHP files. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|