Quantcast
Channel: Forums | InterWorx CP
Viewing all articles
Browse latest Browse all 900

Regarding .tpl file in plugin

$
0
0
Hi,
How can I perform API call (written in php) inside .tpl file ? I have following php code inside .tpl file & If I'm trying to run below code its showing this error 'A system error has occurred. Please try your request again in a few minutes. '.
Its because of SoapClient call. I don't know the proper way to use SoapClient inside the .tpl file, so please suggest me one good example.

{php}
class Test
{
public function authenticate($api_controller, $action, $input=null)
{
$key = array( ’email’ => ’siteworx@siteworx.com’,
’password’ => ’siteworxpass’,
’domain’ => ’example.com’ );
$client = new SoapClient( 'https://%%SERVERNAME%%: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_panel = new Test();
print_r($control_panel->getSize());
{/php}




Thank you,
kiran

Viewing all articles
Browse latest Browse all 900

Trending Articles