A
A
Andrey Plax2014-09-05 18:22:20
PHP
Andrey Plax, 2014-09-05 18:22:20

Why does DOMDocument::loadXML work differently on Apache on Windows and Linux?

Development PC - Apache 2.2 + PHP Version 5.3.28 - Windows 8.1 x64
Production Server - Apache 2.2 + PHP Version 5.3.10 - 1Ubuntu3

$options = array(
        'http' => array(
            'header' => "Content-Type: application/x-www-form-urlencoded\r\n",
            'header' => "Authorization: Basic " . $auth . "\r\n",
            'method' => 'POST',
        ),
    );
$context = stream_context_create($options);
$url = 'http://192.168.0.159/ClientCabinet/hs/clientinf/getinfo';
$result = @file_get_contents($url, false, $context);
$dom = new domDocument("1.0", "utf-8");
$dom->loadXML($result);

Both on a Windows machine and on Linux:
echo var_dump($result); - gives the same result.
but
echo var_dump($dom); - on Windows, it generates a filled XML,
and Ubuntu gets - object(DOMDocument)#1 (0) { }
...
Thanks in advance, if anyone knows or guesses what's wrong ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2014-09-05
Protko @Fesor

Apache has nothing to do with it. PHP Version 5.3.28 and PHP Version 5.3.10 are at least different versions of php. 99,(9)% that the settings are also different (php.ini). Maybe you have xdebug somewhere, maybe something else.
remove the dog, get an error. If you see an error, fix the problem. most likely file_get_contents returns an empty string because it could not download the file and the errors were suppressed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question