Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

parsing xml with xmlapi.php

Discussion in 'cPanel Developers' started by brooks_hunt, Jan 14, 2014.

  1. brooks_hunt

    brooks_hunt Member

    Joined:
    Jan 14, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I'm trying to only display the domains for parked domains. But I don't return anything. Can anyone help?

    PHP:
    include("xmlapi.php");
    $xmlapi = new xmlapi($server_ip);
    $xmlapi->hash_auth($whm_user,$whm_hash);
    $xmlapi->return_xml(1);
    $xmlapi->set_output("xml");
    $data $xmlapi->api2_query($cp_user"Park""listparkeddomains" );
    $xml_object simplexml_load_string($data);
    foreach(
    $xml_object->cpanelresult->data as $key => $value)
    {
    echo 
    $value->domain;
    }
     
  2. brooks_hunt

    brooks_hunt Member

    Joined:
    Jan 14, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Solution

    PHP:
    foreach($xml_object->data as $key => $value)
    {
    echo 
    $value->domain."<br>";
    }
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,711
    Likes Received:
    1,791
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    I am happy to see you were able to find a solution. Thank you for updating the thread with the outcome.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice