Note: trouble with registration? See this for more info.
0 Members and 1 Guest are viewing this topic.
Hi John,The Anole weather graphic script set (now distributed via my legacy scripts) uses a simple text file with the needed weather data. As distributed, the script uses a Weather-Display clientraw.txt or other weather software stickertags.txt file for the required data. The ambient.txt file you'd attached in your post is a JSON-formatted data file, and can't be read/parsed by the existing Anole script directly.However, it should be a simple matter to use a small PHP script to read the ambient.txt, parse the JSON, and return a stickertag text, and then the wxgraphic.php can load the small PHP script (by URL) to get the data needed. Alternatively, the wxgraphic.php could be modified to read/parse the JSON data in ambient.txt directly.Lastly, a note about your sample above of Code: [Select]$data_file_path = '/pwsWD/jsondata/ambient.txt'; Filesystem paths that start with / always reference the root of the filesystem, and likely not the root of the webserver's documents.it's always best to use relative path addressing in PHP for files, so just adding a . (period) makes it Code: [Select]$data_file_path = './pwsWD/jsondata/ambient.txt'; then the file can be found (but in this case, due to it's contents, unable to be used by the wxgraphic.php script as-is).Hope this helps...
$data_file_path = '/pwsWD/jsondata/ambient.txt';
$data_file_path = './pwsWD/jsondata/ambient.txt';
As a general guideline, I recommend you NOT alter someone else's scripts (beyond settings customization) unless you're willing to assume full support for the resulting script. Personally, I prefer to create a 'shim' script to take something and convert it to the format needed by something else, so the script for something else can remain mostly unmodified (beyond normal settings customization). Easier to maintain in the future.With that said, I've attached a shim script that takes the JSON data from ambient.txt and creates a stickertag return.See the script comments for more info.
<?php /******************************************************************************* wxgraphic.php v6.3
<?php error_reporting(E_ALL);ini_set('display_errors','1');/******************************************************************************* wxgraphic.php v6.3