API is not working https://www.softaculous.com/board/index.php?tid=16858 <![CDATA[API is not working]]> https://www.softaculous.com/board/index.php?tid=16858&tpg=1#p53653 Sat, 25 Sep 2021 07:54:46 GMT https://www.softaculous.com/board/index.php?tid=16858&tpg=1#p53653 <![CDATA[API is not working]]> https://www.softaculous.com/board/index.php?tid=16858&tpg=1#p50349 Thu, 23 Jul 2020 16:15:05 GMT https://www.softaculous.com/board/index.php?tid=16858&tpg=1#p50349 <![CDATA[API is not working]]> https://www.softaculous.com/board/index.php?tid=16858&tpg=1#p50346 try this code it should work

$key =  'xxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$pass = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$ip = 'censored IP';

require($_SERVER['DOCUMENT_ROOT'].'/content/addons/Virtualizor/API/admin.php');

                $admin = new Virtualizor_Admin_API($ip, $key, $pass);

                $output = $admin->listvs();

                print_r(json_encode($output));

//if you will just use listvs it will be fine no need to pass $post, $page, $reslen by default page is 0 and reslen i.e. the result length(number of vps to return) is 50 if you want to search vps than only pass $post
//also check if the api key and pass you provide is correct]]>
Thu, 23 Jul 2020 12:41:11 GMT https://www.softaculous.com/board/index.php?tid=16858&tpg=1#p50346
<![CDATA[]]> https://www.softaculous.com/board/index.php?tid=16858&tpg=0#p50305
Why? All data from  the API is 100% correct and when i try to use the API via direct link opening it is working.


PHP Code

 $key =  'xxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$pass 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$ip 'censored IP';

require(
$_SERVER['DOCUMENT_ROOT'].'/content/addons/Virtualizor/API/admin.php');

                
$admin = new Virtualizor_Admin_API($ip$key$pass);

                
$page 0;
                
$reslen 0;
                
//For Searching
                
$post = array();
                
$post['vpsid'] = '';
                
$post['vpsname'] = '';
                
$post['vpsip'] = '';
                
$post['vpshostname'] = '';
                
$post['vsstatus'] = '';
                
$post['vstype'] = '';
                
$post['speedcap'] = '';
                
$post['user'] = '';
                
$post['vsgid'] = '';
                
$post['vserid'] = '';
                
$post['plid'] = '';
                
$post['bpid'] = '';
                
$post['serid'] = '';
                
$post['search'] = '';

                
$output $admin->listvs($page ,$reslen ,$post);

                
print_r(json_encode($output)); // RETURNS "false" 

]]>
Mon, 20 Jul 2020 19:26:54 GMT https://www.softaculous.com/board/index.php?tid=16858&tpg=0#p50305