Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Regarding SoapClient

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
kiranupadhyak
Smarty n00b


Joined: 25 May 2017
Posts: 1

PostPosted: Thu May 25, 2017 9:06 am    Post subject: Regarding SoapClient Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Thu May 25, 2017 1:48 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP