Das habe ich gemacht:
$header = „Connection: keep-alive“;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, „http://192.168.6.161/data/static.xml“);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header); //$user_agent would contain your agent.
$xml = curl_exec($ch); //xml stored in the variable $xml
$xmldata = new SimpleXMLElement($xml);
Ich habe nun kein XML mehr und versuche das wieder in XML zu bringen mit: SimpleXMLElement, geht aber nicht, folgende Fehlermeldung:
Warning: SimpleXMLElement::__construct(): Entity: line 1: parser error : Start tag expected, ‚<‘ not found in C:\IP-Symcon\scripts\37370.ips.php on line 27
Warning: SimpleXMLElement::__construct(): 1 in C:\IP-Symcon\scripts\37370.ips.php on line 27
Warning: SimpleXMLElement::__construct(): ^ in C:\IP-Symcon\scripts\37370.ips.php on line 27
Fatal error: Uncaught exception ‚Exception‘ with message ‚String could not be parsed as XML‘ in C:\IP-Symcon\scripts\37370.ips.php:27
Stack trace: #0 C:\IP-Symcon\scripts\37370.ips.php(27): SimpleXMLElement->__construct(‚1‘) #1 {main}
thrown in C:\IP-Symcon\scripts\37370.ips.php on line 27