PHP-CURL-HTTP-GET-XML-Format

Ich habe eine Anwendung mit einer RESTful-API für Webdienste. Wenn ich im Browser HTTP-GET-Anfragen stelle, erhalte ich XML-Antworten zurück.

Wenn ich dieselbe Anfrage mit PHP stelle, erhalte ich die richtigen Informationen, diese sind jedoch nicht in XML formatiert und können daher nicht an Simple XML übergeben werden.

Hier ist mein Code.

<?php
//Deifne user credentials to use with requests
        $user = "user";
        $passwd = "user";

        //Define header array for cURL requestes
        $header = array('Contect-Type:application/xml', 'Accept:application/xml');

        //Define base URL
        $url = 'http://192.168.0.100:8080/root/restful/';

        //Define http request nouns
        $ls = $url . "landscapes";

        //Initialise cURL object
        $ch = curl_init();

        //Set cURL options
        curl_setopt_array($ch, array(
            CURLOPT_HTTPHEADER => $header, //Set http header options
            CURLOPT_URL => $ls, //URL sent as part of the request
            CURLOPT_HTTPAUTH => CURLAUTH_BASIC, //Set Authentication to BASIC
            CURLOPT_USERPWD => $user . ":" . $passwd, //Set username and password options
            CURLOPT_HTTPGET => TRUE //Set cURL to GET method
        ));

        //Define variable to hold the returned data from the cURL request
        $data = curl_exec($ch);

        //Close cURL connection
        curl_close($ch);

        //Print results
        print_r($data);

?>

Irgendwelche Gedanken oder Vorschläge wären wirklich hilfreich.

S

BEARBEITEN:

Das ist also die Antwort, die ich vom PHP-Code bekomme:

0x100000rhel-mlsptrue9.2.3.0101

Dies ist die Antwort, wenn ich den WizTools Rest Client oder einen Browser verwende.

<?xml version="1.0" encoding="UTF-16"?>
<landscape-response total-landscapes="1" xmlns="http://www.url.com/root/restful/schema/response">
    <landscape>
        <id>0x100000</id>
        <name>rhel-mlsp</name>
        <isPrimary>true</isPrimary>
        <version>9.2.3.010</version>
    </landscape>
</landscape-response>

Wie Sie sehen, sind die Informationen vorhanden, aber das PHP präsentiert sie nicht wirklich auf nützliche Weise.