Page 1 of 19 12311 ... LastLast
Results 1 to 20 of 367

Thread: PHP class for communicating with DA

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

    PHP class for communicating with DA

    Hey.

    This is a small PHP class put together to help communicate with DirectAdmin. It is simple enough, and most anyone can make good use of it.

    Current Version: v2.7.2
    Last updated 2014-03-18

    Download: php-source or tarball

    Numerous implementation examples are located here.

    Pretty nifty, eh?
    Last edited by l0rdphi1; 01-06-2009 at 01:31 AM.
    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

  2. #2
    Join Date
    May 2003
    Location
    /home/admin
    Posts
    298
    An additional method is to simply use fopen(), file(), or getfilecontents() on the full URL. For example:

    PHP Code:
    $diskUsage getfilecontents("http://user:pass@your.server.com:2222/CMD_API_SHOW_USER_USAGE?user=$some_user_name")

    echo 
    "Disk Usage is: $diskUsage"
    Just another way of doing this... :) Thanks for sharing your method, I might put it to good use...
    Matt Savona
    serveIO
    Creator of the DirectAdmin Enhanced Theme

  3. #3
    Join Date
    Jun 2003
    Posts
    1,471
    Originally posted by loopforever
    An additional method is to simply use fopen(), file(), or getfilecontents() on the full URL. For example:

    PHP Code:
    $diskUsage getfileco [...] s$diskUsage"; 
    Just another way of doing this... Thanks for sharing your method, I might put it to good use...
    That doesn't work with the new sessions sytem. And plus you have to parse_strthe results
    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

  4. #4
    Join Date
    Aug 2003
    Posts
    3
    How would you send your information to CMD_ACCOUNT_USER to create an account?
    I made all the fields and such, but I'm unsure on how to send the info.

  5. #5
    Join Date
    Jun 2003
    Posts
    1,471
    John said he'd be adding an API_ACCOUNT_USER soon, but right now I use:
    PHP Code:
            $fsock->request("/CMD_ACCOUNT_USER?username=$client_sql[client_uname]&email=".strtolower($client_sql[client_email])
                .
    "&passwd=$client_sql[client_pword]&passwd2=$client_sql[client_pword]&domain=$client_sql[client_domain]"
                
    ."&bandwidth=".($client_sql[client_bandwidth]*1024)."&quota=$client_sql[client_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=loopXv1&ip=$server_ip&add=Submit&action=create"); 
    $client_sql is an array of the user's data.

    $server_ip the server's shared IP.

    *Note: This example uses the version 1.xx of this class; you need the wrapper to continue in this fashion*
    Last edited by l0rdphi1; 11-22-2003 at 06:00 PM.
    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

  6. #6
    Join Date
    Jun 2003
    Posts
    1,471
    I edited my original post to include version 1.1 of the class.

    I hadn't realized PHP's parse_str() function breaks when DA uses '&' characters in the returned string, and thus version 1.1 fixes this.

    Additionally, I recently replied to this thread with the code I use to create DA accounts.

    Enjoy,

    Phi1.
    Last edited by l0rdphi1; 09-15-2003 at 12:23 AM.
    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

  7. #7
    Join Date
    Aug 2003
    Posts
    575
    Hi,

    Looks interesting, what can it do exactly? Is it just for the API commands?

    Cheers,
    Matt

  8. #8
    Join Date
    Jun 2003
    Posts
    1,471
    Yeah, it's a simple tool for using DA's API. You could use it for other socket connections too though.
    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

  9. #9
    Join Date
    Aug 2003
    Posts
    575
    Thanks

  10. #10
    Join Date
    Jun 2003
    Location
    Alabama, USA
    Posts
    50
    I have one question, when this code is in actual working form, cant someone go "view source" and pull out your username and password for DA Login?
    B. Bryant
    Bryco PC Consulting and Internet Services
    P.O. Box 491, Mc Calla, AL 35111-0491
    http://www.BrycoPc.com/

  11. #11
    Join Date
    Jun 2003
    Posts
    1,471
    Not that I'm aware of. Even if view-source worked for me, shouldn't it only display the HTML source, and not any of the PHP?

    And incase you fear someone actually getting the PHP source: you could always encrypt the password making it at least a little harder to figure out.

    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. #12
    Join Date
    Jun 2003
    Posts
    1,471
    I just updated to 1.2 to fix some problems with url encoded arrays.

    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

  13. #13
    Join Date
    Oct 2003
    Posts
    9
    How about having visitors create mailboxes?

    How do you implement this in the class?

    <form action=/CMD_EMAIL_POP method=POST>
    action=create
    domain=domain.com
    user=emailname (do not include @domain.com)
    passwd=password
    passwd2=password
    create=Create

    ???

  14. #14
    Join Date
    Jun 2003
    Posts
    1,471
    You won't need a class if you're going to send it via a form, but then again, I'm not sure that will even work. Try it, if you please.

    I can modify the class to support POST, but I won't get time enough for that until this weekend.

    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

  15. #15
    Join Date
    Aug 2003
    Posts
    575
    Just post the form to your own PHP script, which in turn parses the form and uses the DA communicating class to send the info on to DA

    Matt

  16. #16
    Join Date
    Jun 2003
    Posts
    1,471
    The problem as I take it is that DA's CMD_EMAIL_POP API doesn't take GET data. As I said though, I can add support for POST this weekend
    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

  17. #17
    Join Date
    Jun 2003
    Location
    Perth, Australia
    Posts
    280
    this needs a little *bump* or a little bit of a sticky?

  18. #18
    Join Date
    Jun 2003
    Posts
    1,471
    I'm currently in the process of rewriting this by the way. Will support both GET and POST, and fix a bug in the array_last_parsed method.

    Feel free to sicky, if you like
    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

  19. #19
    Join Date
    Jun 2003
    Posts
    1,471
    Thanks for the sticky

    We should see v2.0 today. Yay.
    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. #20
    Join Date
    Jun 2003
    Posts
    1,471
    Okay, 2.0 is up. There have been a lot of changes.

    I put together a wrapper for old versions, so you don't have to recode anything. Check that out here.

    Enjoy
    Last edited by l0rdphi1; 01-22-2004 at 01:14 PM.
    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

Page 1 of 19 12311 ... LastLast

Similar Threads

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