Note that there are some explanatory texts on larger screens.

plurals
  1. POnew to xml: Get children data into php variable
    text
    copied!<p>i need a mean and lean solution for my confirmation form. I retrieve the contact e-mail address from the server XML response. That is as follows:</p> <pre><code>&lt;users&gt; &lt;User LoginName="test1" Owner="" Alias="" UserType="PAID" ClientType="OBM" Quota="10737418240" Timezone="GMT+08:00 (CST)" Language="en" DataFile="1" DataSize="1536" RetainFile="0" RetainSize="0" EnableMSSQL="Y" EnableMSExchange="Y" EnableOracle="Y" EnableLotusNotes="Y" EnableLotusDomino="Y" EnableMySQL="Y" EnableInFileDelta="Y" EnableShadowCopy="Y" EnableExchangeMailbox="N" ExchangeMailboxQuota="0" EnableNASClient="Y" EnableDeltaMerge="Y" EnableMsVm="N" MsVmQuota="0" EnableVMware="N" VMwareQuota="0" Bandwidth="0" Notes="" Status="ENABLE" RegistrationDate="1302687743242" SuspendPaidUser="N" SuspendPaidUserDate="20140503" LastBackupDate="1302699594652" EnableCDP="Y" EnableShadowProtectBareMetal="Y" EnableWinServer2008BareMetal="Y" Hostname="123.abc.com"&gt; &lt;Contact Name=""Email="www@qqq.com"/&gt; &lt;/user&gt; … &lt;/users&gt; </code></pre> <p>I got as far that i have the following results:</p> <pre><code>object(SimpleXMLElement)#7 (1) { [0]=&gt; string(6) "Company" } object(SimpleXMLElement)#8 (1) { [0]=&gt; string(26) "email@address.ext" } </code></pre> <p>Now i need those into variables. I seem unable to accomplisch this. My code get to here:</p> <pre><code> $request = "http://$SERVER/obs/api/GetUser.do? SysUser=$SYSUSER&amp;SysPwd=$SYSPWD&amp;LoginName=$logonname"; // Execute the API Call and place the XML output in an Array variable $response = simplexml_load_file($request); // Retrieve the LoginName attribute from the Array foreach($response-&gt;children() as $child) { foreach($child-&gt;attributes() as $data) { echo var_dump($data); } } </code></pre> <p>Any Newbie help would be appriciated. Thank you</p> <p>Frank</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload