PHP class for communicating with DA

Hello


I want to add a new Domain Records type A but the first i want to check if exist!
How can i do this...?


Thank you
 
why not ?

I am trying to change a user's skin using API.

Why is this not possible ? Or what is the correct way of doing it ?

Code:
$sock = new HTTPSocket;
	$sock->connect('---serverip----'],2222);

	$sock->set_login('--user's name----','----password from form ----');

	$sock->set_method('POST');

	$sock->query('/CMD_API_CHANGE_INFO',
	array(
        'skin' => 'cambiar',
        'skinvalue' => $skintochangeto,
    ));

	$result = $sock->fetch_body();

	echo $result;
 
Last edited:
Hello

Hello This is my code

PHP:
$da_server = server ip
$da_user = da admin username
$da_pass = da admin password
$arr = this is array ...

include ("httpsocket.php");

$Sock = new HTTPSocket;

$Sock->connect($da_server, '2222');
$Sock->set_login($da_user, $da_pass);
//$sock->set_method('POST');

$Sock->query('/CMD_API_ACCOUNT_USER', $arr);
$result = $Sock->fetch_parsed_body();
print_r($result);


But return


Code:
Array ( [error] => 1 [text] => Unable to Create User [details] => A valid IP was not provided )


What is this ?
 
Last edited:
Here is what I have so far. I am making this available as open source and would appreciate it if other people woud contribute by building some of the classes or by fixing bugs in the code.

I am fully aware that the code is not 100% and some results are not shown (could use help on this) but at least most of the completed classes work well.


Content of the ZIP file
/code - classes for the API
/config - Configuration file (admin userID, password ...)
/forms - Forms for entering data (links 1-1 to API classes)
/protocol - httpsocket Class


Kind Regards,
Onno Vrijburg

resolveit you are the MAN!! BIG Thanks for this package!!
 
Hey all.
I love this class but..

I cant access my admin account because the skin it was using was deleted.

So does anyone have a command which will set the skin of an account?
 
could some1 put together the features of this class? Im guessing its been evolving a lot since the topic started :)
 
could some1 put together the features of this class? Im guessing its been evolving a lot since the topic started :)

Actually, this class has hardly changed since back then; it's designed to be a base class that only queries the DA APIs.

You can find usage for all of the APIs at these URLs:

http://www.directadmin.com/api.html
http://www.directadmin.com/search_versions.php?query=CMD_API

What someone might consider doing is making a library class that extends this class and implements methods that return result sets for each API, but in my mind that's taking it a bit far. :)

Good luck!

Phil
 
Dns Api

Hello,
Does it have DNS API to add records like
Code:
subdomain.name.zone NS ns1.server.zone
Thank you!
 
Failed to add new user: Cannot create user

I have a reseller level account
I have been trying to get CMD_API_ACCOUNT_USER working for days now , my connection to the api is working as I am able to delete users but not add new , the error I get is "Failed to add new user: Cannot create user Invalid Password" here is my form :-

PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 {
	font-size: 18px;
	font-weight: bold;
}
-->
</style>
</head>

<body>
<form action="../code/da_create_user.php" method="post" name="form_create_user" id="form_create_user">
  <div align="center"></div>
  <table width="90%"  border="0" align="center" cellpadding="0" cellspacing="0">
    <tr> 
      <td colspan="3"><div align="center"><span class="style1">Create an User 
          </span></div></td>
    </tr>
    <tr> 
      <td> </td>
      <td> </td>
      <td> </td>
    </tr>
    <tr> 
      <td width="43%"><div align="right">Username</div></td>
      <td width="2%"> </td>
      <td width="55%"><input name="username" type="text" id="username" value="testuser" size="25" maxlength="12"></td>
    </tr>
    <tr> 
      <td><div align="right">Email address </div></td>
      <td> </td>
      <td><input name="email" type="text" id="email" value="justemail@emailcom" size="50" maxlength="100"></td>
    </tr>
    <tr> 
      <td><div align="right">Password</div></td>
      <td> </td>
      <td><input name="password1" type="password" id="password1" value="password" size="25" maxlength="10"></td>
    </tr>
    <tr> 
      <td><div align="right">Verify Password </div></td>
      <td> </td>
      <td><input name="password2" type="password" id="password2" value="password" size="25" maxlength="10"></td>
    </tr>
    <tr> 
      <td><div align="right">Domain Name </div></td>
      <td> </td>
      <td><input name="domain" type="text" id="domain" value="domaintest.com" size="50" maxlength="76"></td>
    </tr>
    <tr> 
      <td><div align="right">Package</div></td>
      <td> </td>
      <td><select name="package" id="package">
          <option>Basic</option>
        </select></td>
    </tr>
    <tr> 
      <td><div align="right">ip</div></td>
      <td> </td>
      <td><input name="ipaddress" type="text" id="ipaddress" value="xxx.xxx.xxx.xxx"></td>
    </tr>
    <tr> 
      <td><div align="right">Notify User </div></td>
      <td> </td>
      <td><select name="notify" id="notify">
          <option>Yes</option>
          <option selected>No</option>
        </select></td>
    </tr>
  </table>
  <div align="center"></div>
  <p align="center">
    <input type="submit" name="Submit" value="Create Account">
         
    <input type="reset" name="Submit2" value="Reset Form">
</p>
</form>
</body>
</html>

here is the code I am posting to

PHP:
<?php

$username 	= $_POST[username];
$email 		= $_POST[email];
$passwd 	= $_POST[password1];
$passwd2 	= $_POST[password2];
$domain 	= $_POST[domain];
$package 	= $_POST[package];
$notify 	= $_POST[notify];

include '../config/config.php';
include '../protocol/httpsocket.php';
$Socket = new HTTPSocket;

$Socket->connect($siteurl,$siteport);
$Socket->set_login($adminusername,$adminpassword);
// {admin_username} and {admin_password} are not specifically your administrative DA user,
// but rather the user that you want to own this new user.

$Socket->query('/CMD_API_ACCOUNT_USER',
    array(
        'username' => $username, // The User's username. 4-8 characters, alphanumeric
        'email' => $email, // A valid email address
        'passwd' => $password1, // The User's password. 5+ characters, ascii
        'passwd2' => $password2, // Password double check. 5+ characters, ascii
        'domain' => $domain, // A valid domain name in the form: domain.com
        'package' => $package, // One of the User packages created by the Reseller
        'ip' => $ipaddress, // One of the ips which is available for user creation. Only free or shared ips are allowed.
        'notify' => $notify, // yes or no. If yes, an email will be sent to email
        'action' => 'create',
        'add' => 'Submit'
    ));
$result = $Socket->fetch_parsed_body();

if ( $Socket->get_status_code() != 200 || !empty($result['error']) )
{
    // failure.
    echo "Failed to add new user: {$result['text']}<br />{$result['details']}";
} else {
    // new user added.
    print_r('User '.$username.' created...');
}


?>

any help would be great ! :)
 
Some problems with CMD_API_USER_HISTORY

hallo, i'm new with DA API. I'm having some problems with some of the commands.

HTM_passwd ? ( to change password of DA, FTP and database)
CMD_LOGIN_HISTORY ( how to display the login's)
HTM_FTP_CREATE (create ftp account)
CMD_SITE_BACKUP
I'm always getting some page of DA
Key:



<html>

<head>
<meta_http-equiv; Value: \"Content-Type\" content=\"text/html; charset=iso-8859-1\">
<title>DirectAdmin v1.31.0</title>
<script language=\"JavaScript\">
<!-- // start preload code
home_image = new Image();
home_image.src = \"/IMG_SKIN_NAV_HOME_OVER\";
webmail_image = new Image();
webmail_image.src = \"/IMG_SKIN_NAV_WEBMAIL_OVER\";
password_image = new Image();
password_image.src = \"/IMG_SKIN_NAV_PASSWORD_OVER\";
fileman_image = new Image();
fileman_image.src = \"/IMG_SKIN_NAV_FILEMAN_OVER\";
help_image = new Image();
help_image.src = \"/IMG_SKIN_NAV_HELP_OVER\";
logout_image = new Image();
logout_image.src = \"/IMG_SKIN_NAV_LOGOUT_OVER\";
logout_image2 = new Image();
logout_image2.src = \"/IMG_SKIN_NAV_LOGOUT2_OVER\";
// done with preload code -->
</script>

<style type=\"text/css\">
*
{
FONT-SIZE: 8pt;
FONT-FAMILY: verdana, arial, helvetica, sans-serif;
line-height:16px;
}

a
{
TEXT-DECORATION: none;
COLOR: black;
}

a:hover
{
COLOR: #9999CC;
TEXT-DECORATION: underline;
}

.toptext
{
COLOR: #666666;
}

u
{
TEXT-DECORATION: underline;
}

input
{
line-height: 12px

}
.tree
{

COLOR: #C0C0C0;
}

.title
{
COLOR: #000000;
FONT-WEIGHT: bold;
FONT-SIZE: 12pt;
}

td.header
{
FONT-WEIGHT: 600;
FONT-SIZE: 10pt;
COLOR: #EEEEEE;
BACKGROUND: #425984;
}

.menu
{
border: 1px solid grey;
border-style: outset;
}

table.menu
{
BACKGROUND: #FFFFFF;
}

td.menu
{
BACKGROUND: #EEEEEE;
COLOR: #000000;
}

table.tabs
{
width: 100%;
border-width: 1;
border-bottom-style:solid;
border-left-style: none;
border-top-style: none;
border-right-style: none;
border-color: black;
border-collapse:collapse
}

td.tab
{
BACKGROUND: #6A85B5;
border: 1px solid grey;
border-style: outset;
white-space: nowrap;
}

td.tabselected
{
BACKGROUND: #425984;
border: 1px solid grey;
border-style: outset;
white-space: nowrap;
}

td.tabspace
{
width: 1%;
}

.highlighted
{
BACKGROUND: #8CA0C6;
border: 1px solid grey;
border-style: outset;
white-space: nowrap;
cursor: hand;
}

a.tabtext
{
COLOR: #EEEEEE;
TEXT-DECORATION: none
}

a.tabtext:hover
{
COLOR: #EEEEEE;
TEXT-DECORATION: none
}

table.list
{
BACKGROUND: #FFFFFF;
width: 100%;

}

td.list
{
BACKGROUND: #EEEEEE;
white-space: nowrap;
}
td.list2
{
BACKGROUND: #E3E3E3;
white-space: nowrap;
}

td.listwrap
{
BACKGROUND: #EEEEEE;
white-space: wrap;
}
td.listwrap2
{
BACKGROUND: #E3E3E3;
white-space: wrap;
}

.listtitle
{
COLOR: #EEEEEE;
white-space: nowrap;
}

td.listtitle
{
BACKGROUND: #425984;
border: 1px solid grey;
border-style: outset;
background-image: url(\"/IMG_SKIN_GRADIENT\");

}
.white
{
COLOR: white;
}

.off_white
{
COLOR: #CCCCCC;
}

.trim
{
border: 1px solid #8CB7D0;
}

.left-pad
{
padding-left: 70px;
}

.right-pad
{
padding-right: 10px;
padding-left: 10px;
}

.bar-row1
{
BACKGROUND: #3D6C98;
line-height:12px;
white-space: nowrap;
FONT-SIZE: 8pt;
letter-spacing:-0.1em
}

.bar-row2
{
line-height:12px;
white-space: nowrap;
FONT-SIZE: 8pt;
letter-spacing:-0.1em
}

</style>

</head>

<body bgcolor=\"#FFFFFF\" leftMargin=0 rightMargin=0 topMargin=0 bottomMargin=0>

<table height=100% width=100% cellpadding=0 cellspacing=0>
<tr>
<td align=center>

<table height=100% cellpadding=0 cellspacing=0>
<tr>
<td height=100% width=31 background=\"/IMG_SKIN_LEFT_SHADOW\" valign=bottom>
<img src=\"/IMG_SKIN_LEFT_SHADOW\">
</td>

<td valign=top>
<table width=100% height=100% cellpadding=0 cellspacing=0>
<tr>
<td height=120 align=left background=\"/IMG_SKIN_HEADER_NONAME\"><img src=\"/IMG_SKIN_HEADER\"></td>
</tr>
<tr>





<td height=100% valign=top>



<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" background=\"/IMG_SKIN_NAV_BG\">
<tr>
<td><a onMouseOver=\"navhome.src=home_image.src;\" onMouseOut=\"navhome.src=\'/IMG_SKIN_NAV_HOME\';\" href=\"/\"><img name=\"navhome\" border=\"0\" src=\"/IMG_SKIN_NAV_HOME\" width=\"72\" height=\"78\" alt=\"Home\"></a></td>
<td><a onMouseOver=\"navwebmail.src=webmail_image.src;\" onMouseOut=\"navwebmail.src=\'/IMG_SKIN_NAV_WEBMAIL\';\" href=\"http://www.zaboe.be/squirrelmail\" target=_blank><img name=\"navwebmail\" border=\"0\" src=\"/IMG_SKIN_NAV_WEBMAIL\" width=\"72\" height=\"78\" alt=\"Webmail\"></a></td>
<td><a onMouseOver=\"navpass.src=password_image.src;\" onMouseOut=\"navpass.src=\'/IMG_SKIN_NAV_PASSWORD\';\" href=\"/HTM_PASSWD\"><img name=\"navpass\" border=\"0\" src=\"/IMG_SKIN_NAV_PASSWORD\" width=\"72\" height=\"78\" alt=\"Password\"></a></td>
<td><a onMouseOver=\"navhelp.src=help_image.src;\" onMouseOut=\"navhelp.src=\'/IMG_SKIN_NAV_HELP\';\" target=_blank href=\"http://www.site-helper.com/stats.html\"><img name=\"navhelp\" border=\"0\" src=\"/IMG_SKIN_NAV_HELP\" width=\"67\" height=\"78\" alt=\"Help\"></a></td>

<td><a onMouseOver=\"navfileman.src=fileman_image.src;\" onMouseOut=\"navfileman.src=\'/IMG_SKIN_NAV_FILEMAN\';\" href=\"/CMD_FILE_MANAGER\"><img name=\"navfileman\" border=\"0\" src=\"/IMG_SKIN_NAV_FILEMAN\" width=\"72\" height=\"78\" alt=\"File Manager\"></a></td>
<td width=\"100%\" align=right><a onMouseOver=\"navlogout.src=logout_image2.src;\" onMouseOut=\"navlogout.src=\'/IMG_SKIN_NAV_LOGOUT2\';\" href=\"/CMD_LOGOUT\"><img name=\"navlogout\" border=\"0\" src=\"/IMG_SKIN_NAV_LOGOUT2\" width=\"93\" height=\"78\" alt=\"Logout\"></a></td>
</tr>
</table>


<table width=100%>
<tr><td>

<b>Details for user jschrijvers</b><br><br>

<a href=\"/CMD_FILE_MANAGER/domains/jefke007.zaboe.be/logs\">Backed up Apache Logs</a><br>
<a href=\"/CMD_USER_HISTORY?domain=jefke007.zaboe.be\">User History</a><br>

<table class=list cellpadding=3 cellspacing=1>
<tr>
<td class=listtitle>Log Type</td><td class=listtitle>Full Log</td><td class=listtitle>Last lines in the file</td>
</tr>
<tr>
<td class=list>
Apache Usage Log
</td>

<td class=list>
<a href=\"/CMD_SHOW_LOG?domain=jefke007.zaboe.be<br />
Key: type; Value: error<br />
Key: lines; Value: 100\">100 lines</a>
</td>
</tr>
</table>

<table class=list cellpadding=3 cellspacing=1>
<script language=\"Javascript\">
<!--
function selectAll(select)
{
with (document.tableform)
{
var check = false;
var i=0;

for (i=0; i< elements.length; i )
if (elements.type == \'checkbox\')
if (elements.name.substring(0, select.length) == select)
{
check = !(elements.checked); break;
}

for (i=0; i < elements.length; i )
if (elements.type == \'checkbox\')
if (elements.name.substring(0, select.length) == select)
elements.checked = check;
}
}
// -->
</script>

<form name=tableform action=\'CMD_PUBLIC_STATS\' method=\'POST\'>
<tr ><td align=right colspan=7><a class=toptext href=\'?view=advanced<br />
Key: nbsp;; Value: <br />
Key: nbsp;
<a_href; Value: \"/CMD_SHOW_LOG?domain=jefke007.zaboe.be<br />
Key: sort1; Value: 6\'>Suspended</a></td >
<td class=listtitle align=center ><a class=listtitle href=\"javascript:selectAll(\'select\');\">Select</a></td >
</tr >
<tr ><td class=list><a href=\"/CMD_WEBALIZER/jefke007.zaboe.be/index.html\">jefke007.zaboe.be</a></td ><td class=list>0.0863027</td ><td class=list>1.32031</td ><td class=list>0.0364246</td ><td class=list>1</td ><td class=list>no</td ><td class=list align=center ><input type=checkbox name=select0 value=\"jefke007.zaboe.be\"></td ></tr >

<tr ><td class=listtitle align=right colspan=7>Set selected domains to be publicly viewable from /<input type=text size=8 name=\'path\' value=\'stats\'> <input type=submit value=\'Set\' ></td ></tr >
<input type=hidden name=action value=\"public\">
<input type=hidden name=domain value=\"jefke007.zaboe.be\">
</form></table >


<br>
<span style=\"COLOR: red;\">Click on the domain name to view Webalizer stats.</span>
<br><br>
The domain statistics (above table) represent domain directory traffic/space, not total account traffic/space. The statistics below represent <b>total</b> usage.
<br><br>

<table class=list cellpadding=3 cellspacing=1>
<form name=tableform form action=\"CMD_CHANGE_INFO\" method=\"POST\">
<tr ><td class=listtitle>Setting</td >
<td class=listtitle>Current Usage</td >
<td class=listtitle>Maximum Usage</td >
</tr >
<tr ><td class=list>Bandwidth (MB) <input type=button value=\'Details\' onClick=\'window.open(\"CMD_BANDWIDTH_BREAKDOWN\",\"bandwidth\",\"width=740,height=480,scrollbars=yes,resizable=yes\");\'></td ><td class=list>0.9880</td ><td class=list>3072</td ></tr >
<tr ><td class=list2>Total Disk Usage (MB) <input type=submit name=update value=\'Update\'></td ><td class=list2>1.36</td ><td class=list2>50</td ></tr >

<tr ><td class=list><br />
Key: domain; Value: jefke007.zaboe.be\'>Advanced Search</a></td ></tr >
<tr ><td class=listtitle><b><a class=listtitle href=\'?domain=jefke007.zaboe.be<br />
Key: nbsp;Email_Disk_Usage</td_><td_class; Value: list>12.0 KB</td ><td class=list></td ></tr >
<tr ><td class=list2><br />
Key: nbsp;Database_Disk_Usage</td_><td_class; Value: list2>0.00 KB</td ><td class=list2></td ></tr >
<tr ><td class=list># of Domains</td ><td class=list>1</td ><td class=list>1</td ></tr >
<tr ><td class=list2># of SubDomains</td ><td class=list2>1</td ><td class=list2>10</td ></tr >

<tr ><td class=list>POP Email Accounts</td ><td class=list>1</td ><td class=list>5</td ></tr >
<tr ><td class=list2>Email Forwarders</td ><td class=list2>0</td ><td class=list2>unlimited</td ></tr >
<tr ><td class=list>Mailing Lists</td ><td class=list>0</td ><td class=list>0</td ></tr >
<tr ><td class=list2>AutoResponders</td ><td class=list2>0</td ><td class=list2>0</td ></tr >
<tr ><td class=list># of MySQL DBs</td ><td class=list>0</td ><td class=list>1</td ></tr >

<tr ><td class=list2>Domain Pointers</td ><td class=list2>0</td ><td class=list2>0</td ></tr >
<tr ><td class=list>Ftp Accounts</td ><td class=list>1</td ><td class=list>1</td ></tr >
<tr ><td class=list2>Email</td ><td class=list2><input type=text name=evalue size=20 value=\"[email protected]\"><input type=hidden name=domain value=\"jefke007.zaboe.be\"></td ><td class=list2><input type=submit name=email value=\"Save\"></td ></tr >
<tr ><td class=list>Name</td ><td class=list><input type=text name=nvalue size=20 value=\"jschrijvers\"></td ><td class=list><input type=submit name=name value=\"Save\"></td ></tr >
<tr ><td class=list2>Language</td ><td class=list2><select class=selectclass name=lvalue>
<option selected value=\"en\">en</option >
</select ></td ><td class=list2><input type=submit name=language value=\"Save\"></td ></tr >

<tr ><td class=list>IP</td ><td class=list>213.193.228.34</td ><td class=list></td ></tr >
<tr ><td class=list2>Name Server 1</td ><td class=list2>ns1.zaboe.be</td ><td class=list2></td ></tr >
<tr ><td class=list>Name Server 2</td ><td class=list>ns2.zaboe.be</td ><td class=list></td ></tr >
<tr ><td class=list2>Shell Access (ssh)</td ><td class=list2>OFF</td ><td class=list2></td ></tr >
<tr ><td class=list>Secure Socket Layer (ssl)</td ><td class=list>OFF</td ><td class=list></td ></tr >
<tr ><td class=list2>CGI-Bin</td ><td class=list2>OFF</td ><td class=list2></td ></tr >

<tr ><td class=list>PHP</td ><td class=list>ON</td ><td class=list></td ></tr >
<tr ><td class=list2>SpamAssassin</td ><td class=list2>ON</td ><td class=list2></td ></tr >
<tr ><td class=list>Catch-All Email</td ><td class=list>ON</td ><td class=list></td ></tr >
<tr ><td class=list2>Anonymous Ftp</td ><td class=list2>OFF</td ><td class=list2></td ></tr >
<tr ><td class=list>Cron Jobs</td ><td class=list>ON</td ><td class=list></td ></tr >
<tr ><td class=list2>System Info</td ><td class=list2>OFF</td ><td class=list2></td ></tr >

<tr ><td class=list>DNS Control</td ><td class=list>OFF</td ><td class=list></td ></tr >
<tr ><td class=list2>Suspend at Limit</td ><td class=list2>ON</td ><td class=list2></td ></tr >
</form></table >

<center><b></b></center>


</td></tr>
</table>
</td>

</tr>
<tr>
<td style=\"padding: 0px; padding-left: 15px;\">
<font class=tree>jschrijvers</font> <br />
Key: raquo;_<a_class; Value: tree href=\"/CMD_USER_STATS?domain=jefke007.zaboe.be\">User Stats for jschrijvers</a>
</td>
</tr>

<tr>
<td height=39 colspan=3 align=center valign=bottom background=/IMG_FOOTER_WIDE class=white style=\"padding-bottom: 8\">
<a class=\"white\" href=\"http://www.directadmin.com/\">DirectAdmin</a> Web Control Panel © 2007 JBMC Software
</td>
</tr>
</table>


</td>

<td width=31 background=/IMG_SKIN_RIGHT_SHADOW>
</td>
</tr>
</table>



</td>
</tr>
</table>
</body>
</html>

<br />



can somebody help me with the code?

THank u

greatzz jefke007
 
Last edited:
problem with output

Hello i'm new with API of DA.
I posted a message but is was gone when i came back on the form.

can somebody help me fix my output?
Here is the code i use.

$sock->query('/CMD_USER_STATS?domain=jefke007.zaboe.be');
$result = $sock->fetch_parsed_body();
unhtmlentities($result);
parse_str ($result);

foreach ($result as $key => $value) {
echo "Key: $key; Value: $value<br />\n";
}

This is the output
http://jefke007.zaboe.be/stats/test.php

thank u

greatzz jefke007
 
Good nobody knows how to display the date backup example:

See logs recent backups
Sun Jun 22 00:26:47 2008

What is the code API to display
 
API for empty spambox

Hi There,

(first of all, don't pay attention on my english :D)

I'm new here on the forum of DA.
I'm trying to make an website with API.

Most of the parts work, make a new e-mail account, delete e-mail accounts, change passwords, make subdomains etc. etc.

The only thing that don't work right now is to empty a mail account (want to empty the spambox).
In DA this is an option (e-mail management -> e-mail accounts) then you can select an e-mail adres and select 'inbox - imap folders - spambox' and push the empty button.

'CMD_EMAIL_POP', i think, but don't know all the options.
(I've searched a lot on google etc. but won't find it...)

Can someone tell me if it is possible to make an 'empty spambox' button with API.

Thanx, greetz Albert
 
Last edited:
Hi All

Im new to this and just started by using the Api 2.6.
Im trying just the basic examples that came with it like the show all users
but just get Array() displayed and cant find out why..

im just trying to use the sample first as below but still just get Array().

--

include 'httpsocket.php';

$sock = new HTTPSocket;

$sock->connect('http://122.200.136.9',2222);
$sock ->set_method('GET');
$sock->set_login('admin','xxxx');

$sock->query('/CMD_API_SHOW_ALL_USERS');
$result = $sock->fetch_parsed_body();

print_r ($result);
--
Does anybody know the possible reason because im sure im missing something simple.

Any assistance to get started is appreciated.
 
Code:
        $da = new HTTPSocket;

        $da->connect('http://122.200.136.9',2222);
        $da->set_login('admin','xxxx');

        $da->query('/CMD_API_SHOW_ALL_USERS');
        $users = $da->fetch_parsed_body();
        
        print_r($users);

Try this. :)
 
Back
Top