The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

parsing xml with xmlapi.php

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

  1. brooks_hunt

    brooks_hunt Registered

    Joined:
    Jan 14, 2014
    Messages:
    2
    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 Registered

    Joined:
    Jan 14, 2014
    Messages:
    2
    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:
    37,184
    Likes Received:
    1,295
    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.
     
Loading...

Share This Page