Can anybody help me?
The problem is that it is somewhere in your code, but nobody else but you can look into that code.
PHP is executed on the webserver into =>HTML, which is then send => to the browser.
So we only see the results. Not the code.
And we have no access to your xml to check what is going into the PHP.
=== Other WL.com scripts have no problemI have my own Weatherlink.com template scripts:
http://www.weerstation-leuven.be/weatherWLC/Remark: The test-site runs for a website in Vancouver Canada so the "last updated" times are recalculated for Vancouver timezone but the xml is recent for Leuven-time.
The xml from my station in Leuven is used:
http://www.weatherlink.com/user/wvdkuil/index.php?view=summary&headers=1There are no differences between the WL.com xml and the converted values to metric. Neither on WL.com as on my site.
This script is used to read the xml, convert it to needed UOMs (unit of measurent - C F and so on.) and cache the result for reuse if a next request is arriving very fast.
http://www.weerstation-leuven.be/weatherWLC/uploadXX/tagsWLCOM.php?sce=view=== Add debug / test codeAs with most scripts, at least 20% of the code of the scripts above is debugging code to understand what is going on.
What you should do to tackle the problem:
1. Load one xml file and put that in a local file on your webserver.
You are going to use that file to test until you are satisfied.
Also later on when you change something in your scripts you should use that test-file first.
2. Change te loading procedure with a setting to either load the xml form WL.com (using userid and password) or from the local test-file. Use a setting default to false, only when you change it to true the test is
3. Use a few extra lines around the fields with the error.
if ($test) {
echo <pre>.PHP_EOL;
echo $your xml filed before any conversion.' - '.$your field after conversion.PHP_EOL;
}
=== your remark: in fact the values are not exactly the sameThis can have many reasons, and again without the code it is only guessing:
Is the conversion routine wrong:
Are some fields correct -or- are they all in error?
Did you make a typo when copying:
Did you put the conversion in a function- or- did you copy it multiple times?
A simple programming error;
Same fieldname used on multiple locations?
=== Give us some info to help you.Many people on this forum want to help. But without the php.code and the xml we can not do anything.
It would be wise to first make a small script which converts (parts of) the xml and separate that from your web-page.
Than you can post that script and the test xml so we can take a look.
Wim