Witam! Będę bardzo wdzięczny za podpowiedź.
Staram się zaimplementować pogodę na stronę internetową. Mam taki oto plik XML:
<?xml version="1.0" encoding="UTF-8"?>
<forecasts>
<polska>
<kujawsko-pomorskie>
<wloclawek type="array">
<forecast>
<sign-human>prawie bezchmurnie</sign-human>
<wind-heading type="integer">48</wind-heading>
<relhum type="float">39.0</relhum>
<pressmsl type="float">1027.3</pressmsl>
<temp-max type="float">25.8</temp-max>
<wind-speed type="float">7.2</wind-speed>
<press type="float">1021.4</press>
<precip type="float">0.0</precip>
<apparent type="float">26.1</apparent>
<temp-min type="float">9.4</temp-min>
<sign>schl</sign>
<forecast-date type="date">2011-05-10</forecast-date>
</forecast>
<forecast>
<sign-human>prawie bezchmurnie</sign-human>
<wind-heading type="integer">131</wind-heading>
<relhum type="float">29.0</relhum>
<pressmsl type="float">1022.7</pressmsl>
<temp-max type="float">24.3</temp-max>
<wind-speed type="float">10.8</wind-speed>
<press type="float">1016.5</press>
<precip type="float">0.0</precip>
<apparent type="float">25.7</apparent>
<temp-min type="float">10.2</temp-min>
<sign>schl</sign>
<forecast-date type="date">2011-05-11</forecast-date>
</forecast>
<forecast>
<sign-human>zachmurzenie małe</sign-human>
<wind-heading type="integer">177</wind-heading>
<relhum type="float">27.0</relhum>
<pressmsl type="float">1015.0</pressmsl>
<temp-max type="float">25.4</temp-max>
<wind-speed type="float">18.0</wind-speed>
<press type="float">1008.6</press>
<precip type="float">0.0</precip>
<apparent type="float">25.4</apparent>
<temp-min type="float">10.7</temp-min>
<sign>sjhaa</sign>
<forecast-date type="date">2011-05-12</forecast-date>
</forecast>
</wloclawek>
</kujawsko-pomorskie>
</polska>
</forecasts>
I chciałym wyciągnąć np "sign-human" z pierwszego "forecast". Oto przykładowy kod:
$url = 'http://mojplikxml.xml';
$xml = simplexml_load_file($url);
echo $xml->polska->kujawsko-pomorskie
->wloclawek[0
]->forecast->sign-human
;
Skrypt zwraca mi błąd: "Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' in /pl/pogoda.inc.php"
Co robię źle. Podpowiecie?