PHP class for communicating with DA

Hello,

I have never use an API before and know very little about what to do. I have read through this thread but am some what confused on what to do. I have a customer with 750+ email accounts that need to put on the server and have a couple of questions.

I have copied the httpsocket.php file to the server. What I am not sure about is:

1) What is the best way to create a file with this many email addresses? As I do not want to add them 1 by 1.

2) How do I send the cmd_api_pop file to the server. Do I upload the file to the server and then call it from a browser or do I run this from shell or is there some other way of doing it?

Thanks in advance for the help.
 
Onno actually did answer you.

If you want to know how to be a PHP programmer, I'm afraid that's well beyond the scope of this forum.

Jeff
 
Hello

I want to get all information about user, that are available,
like mail, ip,.. etc..
that are available like from admin panel..

I cann't fined the api function witch made that..

so plz help...

thanks
 
Hi,

I try to use httpsoket class, but always get meesage
"The request you've made cannot be executed because it does not exist in your authority level" as result

does it mean that I cann`t use DirectAdmin API in my reseller account?
 
rus :
äà , òîëüêî äëÿ ýòîãî þçàé ñîîòâåñòâåíûå api êîìàíäû , òîøî ÿ íàïèñàë - ýòî äëÿ àäìèíñêîãî óðîâíÿ
 
zumo
Ñïàñèáî.


all
How to determine is user authorized or no? i.å. user login into the DirectAdmin and then he follow to my link. That link start my script. How can I determine that user is authorized?

PS: sorry for my english
 
When i'm trying to use the API, I always turn up with the DirectAdmin login screen and an empty array on socket error

I would appreciate any suggestions

PHP:
<?php

include 'httpsocket.php';
$sock = new HTTPSocket;

$sock->connect("myserver", 2222);
$sock->set_login("admin","mypassword");
$sock->set_method('POST');
$sock->query('/CMD_API_VERIFY_PASSWORD',
  array(
    'user' => 'mytestuser',
    'passwd' => 'mytestpassword'
  ));
$result = $sock->fetch_body();

print_r($result);
print_r($sock->error);

?>
 
Hi,

I am trying to get the API to create an FTP account for me but unfortunately it ain't working out the way I want to.
the FTP account does not get created whatever I try.

could you help me out here and point me in the right direction?

version of DA : 1.26.1
version of httpsocket : 2.6

thanks

source code:

Code:
<?php
include 'httpsocket.php';

$sock = new HTTPSocket;

$sock->connect('www.domain.com,',2222);
$sock->set_login('user','pass');


$sock->set_method('POST');
$sock->query('/CMD_API_FTP',
	array(		
		'action' => 'create',
		'domain' => 'domain.com',
		'user' => 'testy',
		'type' => 'user',
		'passwd' => 'testpas',
		'passwd2' => 'testpas',
		'create' => 'Create'		
	));
$result = $sock->fetch_body();

if ( $sock->get_status_code() != 200 || !empty($result['error']) )
{
    // failure.
    echo "Failed to add new ftp: {$result['error']}<br />{$result['text']}";
}
print_r($result);
 
hmm ..

oops ...

found it ... a typo in my connect string

I had 'www.domain.com,' instead of 'www.domain.com'

my apologies for being to hasty ;)

regards
 
I want an automatic list of all available domains what are on my servers. Or a list of domains owned by a couple of users.

(want to make an dropdown menu with sites i made automaticly..)

How to do this?
 
You'll have to collect a list of all users on the server, or just selected users, then foreach user retrieve the domain list and add them to a master array.
 
or you could simply read the /etc/virtual/domains file for a complete list of domain names on the server.
 
As in you want code?

Your lucky I'm in a programming mood today ;)

This is the gist of it:
PHP:
foreach (file('/etc/virtual/domains') as $domain)
{
echo $domain;
}
 
Back
Top