Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Nov 2009
    Posts
    3

    Exclamation MysqlFE::listdbs modify output?

    PHP Code:
    public function listdbs($username) {
            if (!isset(
    $username)) {
                
    error_log("listdb requires that user is passed to it");
                return 
    false;
            }
            return 
    $this->api2_query($username'MysqlFE''listdbs');
        }


    *******************************************

    include(
    "xmlapi.php");

    $ip "*******";
    $root_pass "********";

    $account "******";

    $xmlapi = new xmlapi($ip);
    $xmlapi->password_auth("root",$root_pass);

    $xmlapi->set_debug(1);

    print 
    $xmlapi->api2_query($account'MysqlFE''listdbs'); 
    I'm running this code form an external php script, but it's out put is nothing. I can't see any thing...

    What I have to do to print list of databases....

  2. #2
    cPanel Staff cPanelMatt's Avatar
    Join Date
    Apr 2005
    Location
    Houston, TX
    Posts
    409

    Default

    $xmlapi->set_output('xml');
    print $xmlapi->api2_query($account, 'MysqlFE', 'listdbs');

    OR:

    print_r( $xmlapi->api2_query($account, 'MysqlFE', 'listdbs') );


    The API queries don't return strings by default, rather they return simplexml objects. (see: php.net/simplexml)

    You can either use the set_output() function to set the type of output you want (xml) or you can use print_r to display the object.
    Matt Dees
    Integration Developer
    cPanel, Inc.
    cPanel Integration Blog

  3. #3
    Registered User
    Join Date
    Nov 2009
    Posts
    3

    Default :):):)

    Thank you... It will help me.....

Similar Threads & Tags
Similar threads

  1. Api 2 MysqlFE userdbprivs problems
    By elia in forum cPanel Developers
    Replies: 2
    Last Post: 08-30-2010, 10:44 AM
  2. MysqlFE::userdbprivs() syntax
    By lvt in forum cPanel Developers
    Replies: 13
    Last Post: 07-30-2010, 02:25 PM
  3. MysqlFE::userdbprivs() returning only 1
    By testpgm in forum cPanel Developers
    Replies: 0
    Last Post: 05-26-2010, 03:09 AM
  4. modify package doesn't seem to run through users and modify!!
    By rpmws in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 07-01-2005, 02:19 PM
  5. Replies: 2
    Last Post: 12-09-2003, 06:12 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube