Page 3 of 19 FirstFirst 1234513 ... LastLast
Results 41 to 60 of 369

Thread: PHP class for communicating with DA

  1. #41
    Join Date
    Mar 2004
    Posts
    23

    Thenx

    Cool, thenx you!

    I will go and experiment

    Greetz

  2. #42
    Join Date
    Jun 2003
    Posts
    1,471
    I have updated the communication class to version 2.1, which includes support for DA's new skin login key system.

    From within a skin, you may now use the following to login as the code-executing (or "current") user:
    PHP Code:
    $Socket = new HTTPSocket;
    $Socket->connect('127.0.0.1',2222);
    $Socket->set_login($_SERVER['USER']);
    // $_SERVER['USER'] will always contain the current user's name

    $Socket->query('/CMD_API_SHOW_DOMAINS');
    $r_ query_result $Socket->fetch_parsed_body()

    print_r($r_query_result); 
    Remember, this only works within skins.

    Enjoy.
    Installatron Plugin is a native DirectAdmin plugin that provides you and your customers an intuitive interface to install, manage, upgrade, and backup/restore a premier collection of the best applications on the web, all instantly at the click of a button.

    Also: cPanel-to-DA converterBulk Domains and Sub-domain PluginDA User Tool

  3. #43
    Join Date
    Feb 2004
    Location
    Papendrecht, Netherlands
    Posts
    20
    Can you please fix the download links?

    Tnxz!

  4. #44
    Join Date
    Jun 2003
    Posts
    1,471
    Working for me. Give it another go.
    Installatron Plugin is a native DirectAdmin plugin that provides you and your customers an intuitive interface to install, manage, upgrade, and backup/restore a premier collection of the best applications on the web, all instantly at the click of a button.

    Also: cPanel-to-DA converterBulk Domains and Sub-domain PluginDA User Tool

  5. #45
    Join Date
    Feb 2004
    Location
    Papendrecht, Netherlands
    Posts
    20
    hmm http://www.l0rdphi1.com/tools/httpso...psocket.tar.gz that link and the phps link give me a page cannot be displayed message
    can you please mail me the .tar.gz at my support@youcme.nl email adres?

    weird that i can't see the page
    tnxz in advance

    YouCMe

  6. #46
    Join Date
    May 2004
    Location
    Denver, CO
    Posts
    1

    The total example

    Hi everybody,

    somewhat new to PHP and I am wondering if anybody would be oppossed to showing me a complete example. How this api works with your clients hosting registration form. Or maybe just a clarification of what is really required to make this work.

    After reading this thread here is what I think is supposed to be done, someone please let me know if this is correct:

    [list=1]
    I need to create my form which gathers the user information
    The form action should be add_domain.php or whatever it is I am trying to do
    make sure I include a call to the httpsocket.php from with in the form action script.[/list=1]

    Is it that simple?

    I am not sure as I have seen a multitude of different things in the forums. For instance, what about this - (used by some to create new accounts):

    http://www.directadmin.com/forum/sho...d=492#post2786 -

    <?php

    $obj->request("/CMD_API_ACCOUNT_USER?username=<username>&email=<email>&passwd=<password>"
    ."&passwd2=<password>&domain=<primary_domain>&bandwidth=<megs_bandwidth>"
    ."&quota=<megs_storage>&uvdomains=ON&unsubdomains=ON&unemails=ON&unemailf=ON"
    ."&unemailml=ON&unemailr=ON&umysql=ON&udomainptr=ON&uftp=ON&aftp=ON&cgi=ON&ssl=ON"
    ."&suspend_at_limit=ON&skin=<skin>&ip=<server_ip>&add=Submit&action=create");

    $result = $obj->array_last_parsed();

    if ($result[error]) {

    echo "Woo. There was an error.<p>$result[details]";

    exit;
    }

    echo $result[text];

    ?>

    How does all this tie together? And what about the wrapper he mentions at the bottom of the post?

    Any help would be appreciated.

    Thanks,
    3DPN

  7. #47
    Join Date
    Sep 2003
    Posts
    97
    is it possible to log someone in using this by their e-mail name and pass for that? I have a staff only section on my irc net page im working on and it would be easier if they could just have one pass for everything, and that way I wouldnt have to make a whole new system.
    Useful Links: [:: Intro to Unix :: Direct Admin Support ::]
    Web programing/design: [:: PHPFreaks :: W3 :: Good Tutorials ::]

  8. #48
    Join Date
    Aug 2003
    Posts
    575
    The class doesn't support HTTPS does it?

    Matt

  9. #49
    Join Date
    Jun 2003
    Posts
    1,471
    Originally posted by thoroughfare
    The class doesn't support HTTPS does it?

    Matt
    Yes, actually it does. PHP's "https" is ssl://
    PHP Code:
    $socket = new HTTPSocket;
    $socket->connect('ssl://yourserver',2222);

    $socket->method('POST'); // this is an optional call; default is GET
    $socket->query("/CMD_API_SHOW_USERS",array( 'user'  => 'admin' ));

    if (
    $socket->fetch_parsed_body())
    {
         
    print_r($socket->fetch_parsed_body());

    Installatron Plugin is a native DirectAdmin plugin that provides you and your customers an intuitive interface to install, manage, upgrade, and backup/restore a premier collection of the best applications on the web, all instantly at the click of a button.

    Also: cPanel-to-DA converterBulk Domains and Sub-domain PluginDA User Tool

  10. #50
    Join Date
    Jun 2003
    Posts
    1,471
    Hello,
    Originally posted by ctnchris
    is it possible to log someone in using this by their e-mail name and pass for that? I have a staff only section on my irc net page im working on and it would be easier if they could just have one pass for everything, and that way I wouldnt have to make a whole new system.
    Hmm.. I don't think you can login to DA's API via an email address, but you may be able to at least verify they've got the right email password using PHP's IMAP functions.

    http://www.php.net/imap

    Phi1.
    Installatron Plugin is a native DirectAdmin plugin that provides you and your customers an intuitive interface to install, manage, upgrade, and backup/restore a premier collection of the best applications on the web, all instantly at the click of a button.

    Also: cPanel-to-DA converterBulk Domains and Sub-domain PluginDA User Tool

  11. #51
    Join Date
    Jun 2003
    Posts
    1,471

    Re: The total example

    3DPN,
    Originally posted by 3DPN
    [list=1]I need to create my form which gathers the user information
    The form action should be add_domain.php or whatever it is I am trying to do
    make sure I include a call to the httpsocket.php from with in the form action script.[/list=1]

    Is it that simple?
    I think it is indeed that simple. Here's add_domain.php for you: http://www.l0rdphi1.com/tools/httpso...dd_domain.phps

    Originally posted by 3DPN
    And what about the wrapper he mentions at the bottom of the post?
    That's useless if you're instancing HTTPSocket (the wrapper only applies to instances of HTTPGetSocket).

    Good luck!

    Phi1.
    Installatron Plugin is a native DirectAdmin plugin that provides you and your customers an intuitive interface to install, manage, upgrade, and backup/restore a premier collection of the best applications on the web, all instantly at the click of a button.

    Also: cPanel-to-DA converterBulk Domains and Sub-domain PluginDA User Tool

  12. #52
    Join Date
    Aug 2004
    Posts
    25

    Why doesn't this work?

    Hi i'm trying to get the class running


    but i only get empty arrays till now


    PHP Code:
    <?php

    include "httpsocket.php";

    $sock = new HTTPSocket;
    $sock->connect('myserverip',2222);

    $sock->set_login("admin","mypass");

    $sock->query('/CMD_API_SHOW_USER_USAGE&user=usernameofaccount');
    $result $sock->fetch_body();

    print_r(array_values($result));


    ?>
    i also tryed this

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

    $sock = new HTTPSocket;

    $sock->connect('ssl://myipnumber,'2222');
    $sock->set_login('
    admin','mypasswd');

    $sock->query('
    /CMD_API_SHOW_USER_USAGE?user=ausername');
    $result = $sock->fetch_body();


    echo $result;

    ?>
    Last edited by nbhosting; 08-06-2004 at 10:06 AM.
    Greetz
    Gerd

  13. #53
    Join Date
    Jun 2003
    Posts
    1,471
    Hello,

    Is your server running over SSL or not? Only use ssl:// when running over SSL.

    $sock->query('/CMD_API_SHOW_USER_USAGE&user=usernameofaccount');
    That should be:
    Code:
    $sock->query('/CMD_API_SHOW_USER_USAGE','user=usernameofaccount');
    Good luck, Phi1.
    Installatron Plugin is a native DirectAdmin plugin that provides you and your customers an intuitive interface to install, manage, upgrade, and backup/restore a premier collection of the best applications on the web, all instantly at the click of a button.

    Also: cPanel-to-DA converterBulk Domains and Sub-domain PluginDA User Tool

  14. #54
    Join Date
    Aug 2004
    Posts
    25
    PHP Code:
    <?

    include 'httpsocket.php';

    $sock = new HTTPSocket;

    $sock->connect('ssl://217.170.21.24',2222);
    $sock->set_login('admin','myadminpass');

    $sock->query('/CMD_API_SHOW_USER_USAGE','user=project14');
    $result $sock->fetch_result();

    echo 
    $result;

    ?>
    still only get blank pages
    i got ssl activated on the domain i'm working on
    i also tryed to disable ssl and the use only the ipnummer

    no succes there also
    Last edited by nbhosting; 08-06-2004 at 07:15 PM.
    Greetz
    Gerd

  15. #55
    Join Date
    Jun 2003
    Posts
    1,471
    The question is: Is DirectAdmin running over SSL?

    If it is, use ssl://

    If it is not, just put the IP

    Phi1.
    Installatron Plugin is a native DirectAdmin plugin that provides you and your customers an intuitive interface to install, manage, upgrade, and backup/restore a premier collection of the best applications on the web, all instantly at the click of a button.

    Also: cPanel-to-DA converterBulk Domains and Sub-domain PluginDA User Tool

  16. #56
    Join Date
    Aug 2004
    Posts
    25
    i tryed both ways

    both return me an empty array
    Greetz
    Gerd

  17. #57
    Join Date
    Jun 2003
    Posts
    1,471
    And the proper value IS returned from:

    https://217.170.21.24:2222/CMD_API_S...user=project14

    ?

    Phi1.
    Installatron Plugin is a native DirectAdmin plugin that provides you and your customers an intuitive interface to install, manage, upgrade, and backup/restore a premier collection of the best applications on the web, all instantly at the click of a button.

    Also: cPanel-to-DA converterBulk Domains and Sub-domain PluginDA User Tool

  18. #58
    Join Date
    Aug 2004
    Posts
    25
    thatway i get promted for login and my ssl warning after that i get the right output
    Greetz
    Gerd

  19. #59
    Join Date
    Jun 2003
    Posts
    1,471
    You do have OpenSSL complied into _PHP_, yes? That's needed to make ssl:// queries.

    Phi1.
    Installatron Plugin is a native DirectAdmin plugin that provides you and your customers an intuitive interface to install, manage, upgrade, and backup/restore a premier collection of the best applications on the web, all instantly at the click of a button.

    Also: cPanel-to-DA converterBulk Domains and Sub-domain PluginDA User Tool

  20. #60
    Join Date
    Aug 2004
    Posts
    25
    i will check
    Greetz
    Gerd

Page 3 of 19 FirstFirst 1234513 ... LastLast

Similar Threads

  1. DA PHP Class with DA API Functions
    By DJVG in forum Scripting / API
    Replies: 14
    Last Post: 01-17-2012, 03:49 PM
  2. different nameserver for each Class C
    By gtgart in forum DNS
    Replies: 2
    Last Post: 11-20-2008, 04:50 PM
  3. Ruby API Class
    By voxxitdesigns in forum Scripting / API
    Replies: 21
    Last Post: 07-31-2008, 08:52 PM
  4. JAVA class for communicating with DA
    By gpfault in forum Scripting / API
    Replies: 0
    Last Post: 03-31-2005, 07:59 PM
  5. Da+php+da Class
    By fusionictnl in forum General Technical Discussion & Troubleshooting
    Replies: 0
    Last Post: 10-27-2004, 03:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •