PHP class for communicating with DA

Hello,

there is a big problem with the new html safe characters feature in version 1.203.

The "parse_str" PHP Function will not work together with the unicode html characters.... :-(

Benny

---
Linuworx.de
 
Last edited:
Hi,

sorry, but this feature is terrible. :( Nothing against html safe characters, but it blocks any php or perl script.

If you use &#[NUMBER], PHP didn't work, because it misinterprets the GET Variables. If you use %[NUMBER] Perl will make problems...

The %[NUMBER] works with PHP, but this is not HTML safe, isn't it? I must search and replace all the characters all the time...

Out of the frying pan into the fire... :(

Benny
 
Last edited:
Just escape = and & somehow, with some character sequence, or something. Nothing else is needed.

= -> |EQL|
& -> |AMP|

or something. :)

With the class I can easily convert these back to = and &.
 
Ah, yes. For some reason I was under the impression this still wasn't fixed. Sorry :)
 
ERROR

Hi,

Every time I try to use this, it tells me:

Could not excute your request



Details
You do not own that domain

Would anyone know why that is?
 
Check and make sure you're using the admin|{username} // {admin_password} login format
 
I found what was wrong!

In the examples, it showed the domain name to be inside {}, apparently, the {} are not needed. After I took those out, it worked fine.

This is what I'm talking about:


<?php

include 'httpsocket.php';

$sock = new HTTPSocket;

$sock->connect('comain.com',2222);
$sock->set_login('username,'************');

$sock->set_method('POST');

$sock->query('/CMD_EMAIL_POP',
array(
'action' => 'create',
'domain' => 'domain.com', //NOT '{domain.com}'
'user' => 'start',
'passwd' => 'pass',
'passwd2' => 'pass',
'create' => 'Create'
));
$result = $sock->fetch_body();

echo $result;

?>
 
QUESTION

I have a Question though...

How can you set it so that after, lets say, the POP account has been created, the default header (Log Out, Change Password, Help, buttons, and on the left, the DA Logo, and the tree) don't show up?

The links are broken anyways, which I guess is good cuz noone wants visitors to be able to do anything after creating their Email account...
 
lidios said:
In the examples, it showed the domain name to be inside {}, apparently, the {} are not needed. After I took those out, it worked fine.
Yeah, sorry, I use them to show you need to insert something. Maybe using $whatever inplace of {whatever} would be better.
lidios said:
How can you set it so that after, lets say, the POP account has been created, the default header (Log Out, Change Password, Help, buttons, and on the left, the DA Logo, and the tree) don't show up?
You're going to have to regex the body result and cut out anything you don't want.

Remember, any CMD_API* token will return a pretty result that this php class can parse. It's the other tokens that end up returning their in-DA HTML values.
 
Last edited:
I have just tried to use the finished example of the CMD_DOMAIN script from l0rdphi1.

I change the login and password, servername and what the domain it should create.

Run the script and end up on the login page, nothing seems to be runned.

No errors?

Creating a user works fine but i want to be able to create a second domain with CMD_DOMAIN (which isn't in the API list).

/Best Regards
Marcus
 
PHP:
<?php

include 'httpsocket.php';

$sock = new HTTPSocket;
$sock->connect('ssl://ipadress',2222);

$sock->set_login("admin|web270","notforyou!");

$sock->set_method('POST');

$sock->query('/CMD_DOMAIN',
    array(
        'action' => 'create',
        'domain' => 'kalletestar.se',
        'ubandwidth' => 'unlimited',
        'uquota' => 'unlimited',
        'ssl' => 'OFF',
        'cgi' => 'ON',
        'php' => 'ON',
        'create' => 'Create'
    ));
$result = $sock->fetch_body();

echo $result;

?>

There it is!
 
Hmmmm. You are using your 'admin' user password, correct? Besides the SSL connection (which people have been having trouble with), that looks like it should work without any problems. Are you sure your PHP configuration is set up to handle ssl:// includes in PHP? (I'd guess it is, though)
 
Solved!

Used the wrong password.

One shall not work on mondays!

/Marcus
 
Last edited:
Question

OKe,

I'm new with this so bare with me :D

Oke I have a reseller account with a certain hostingcompany... Created a new user with a own domain, where I want to automatically, with the help of PHP, create new subdomains and emailaccounts.

for example:

'mydomain.com' is the account, with 'test' as username and 'rain' as password
And I want to create the next examples:

test.mydomain.com

and

[email protected]


Well the email part worked with me, by using the virtual email commands : /CMD_API_POP

The username + password I used for that command were the username and password of the 'mydomain.com' account (created under 'Your Reseller').

But the listing and creation of subdomains, doesn't work with me. I will c&p an example where I was trying to print a list of already existing subdomains:

PHP:
$sock = new HTTPSocket;  
$sock->connect("<my IP>",<my Port>); 
$sock->set_login("test","rain");$sock->query('/CMD_API_SUBDOMAINS', array('domain' => 'mydomain.com'));    

$result = $sock->fetch_parsed_body();  
print_r($result);


What am I doing wrong :D
 
Aaaahhh

A little bit of reading explains a LOT :)

oke they are running 1.21.0 and the commands I try to use are implements in 1.21.2 -> figures...

So I'll just bug those guys, if the want to upgrade...

I'll be back :D
 
Next Question ;)

Oke next question... I can do almost everything:

create subdomains
create databases
create emailboxes

and get lists of all the options above.

BUT is it also possible to create FTP accounts (under the subdomain)? I can't find anything about it in the API, but I've to admit, I'm a really bad reader as well as a writer :D

So is FTP control something I overlooked or just not present... and where can I request such a API extention ;) Because if I'm getting it right "l0rdphi1" is the PHP code master, but not the DA developer, that's John isn't it?

Greetz
 
Hello,

Anything you can do via webbrowser can be done via the API. The only difference is that you might not get a parseable result, but the command will be executed. Just load the desired page in your web browser, go "view source" and retrieve all form values for the command you want and apply them to your script.

John
 
Back
Top