($ String) simplexml_load_string boş bir nesne döndürür ama $ string xml içeriyor?

0 Cevap php

Xml formatında cURL kullanarak bazı bilgileri almak.

....

$xml = curl_exec($ch);

$data = simplexml_load_string($xml);
print_r($data);
//out put - SimpleXMLElement Object ( ) 

if I try - print_r($xml); and view page source I get

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <ns7:users xmlns="http://www.example.com/xml/ns/rs" 
        xmlns:ns2="http://www.example.com/xml/ns/users" 
        xmlns:ns3="http://www.example.com/2004/11/tHistory" 
        xmlns:ns4="http://www.example.com/fsi/tHistory" 
        xmlns:ns5="http://www.example.com/2005/10/tHistory" 
        xmlns:ns6="http://www.example.com/2010/03/cs" 
        xmlns:ns7="http://www.example.com/2005/10/users" 
        xmlns:ns8="http://www.example.com/2010/03/tHistory">
    <ns7:user><ns7:id>Matt.Smith</ns7:id>
    <ns7:lastName>Smith</ns7:lastName>
    <ns7:firstName>Matt</ns7:firstName>
    <ns7:otherName></ns7:otherName>
    <ns7:gender>male</ns7:gender>
    <ns7:email>matt@company.co.uk</ns7:email>
    <ns7:locale>en</ns7:locale>
    <ns7:role><ns7:id>A</ns7:id>
    <ns7:name>System Administrator</ns7:name></ns7:role>
    <ns7:employeeNumber></ns7:employeeNumber>
    <ns7:organization>
        <ns7:id>8000</ns7:id>
        <ns7:name>Organisation Title</ns7:name>
    </ns7:organization>
    <ns7:organization>
        <ns7:id>20707</ns7:id>
        <ns7:name>London Office</ns7:name>
    </ns7:organization>
    <ns7:attribute>
        <ns7:code>0</ns7:code>
        <ns7:description>Unassigned</ns7:description>
    </ns7:attribute>
    <ns7:attribute>
        <ns7:code>0</ns7:code>
        <ns7:description>Unassigned</ns7:description>
    </ns7:attribute>
    <ns7:attribute>
        <ns7:code></ns7:code>
        <ns7:description>Unassigned</ns7:description>
    </ns7:attribute>
    <ns7:attribute>
        <ns7:code></ns7:code>
        <ns7:description>Unassigned</ns7:description></ns7:attribute>
        <ns7:attribute><ns7:code></ns7:code>
        <ns7:description>Unassigned</ns7:description>
    </ns7:attribute>
    <ns7:attribute>
        <ns7:code></ns7:code>
        <ns7:description>Unassigned</ns7:description>
        </ns7:attribute>
    <ns7:attribute>
        <ns7:code></ns7:code>
        <ns7:description>Unassigned</ns7:description>
    </ns7:attribute>
    <ns7:attribute>
        <ns7:code></ns7:code>
        <ns7:description>Unassigned</ns7:description>
    </ns7:attribute>
    </ns7:user>
</ns7:users>

Bu xml her biri bir satırda ve ben elle satır okunabilir hale getirmek kırar girdiniz.

0 Cevap