Author Topic: Need assistance setting AWN to my Saratoga Template  (Read 1138 times)

0 Members and 1 Guest are viewing this topic.

Offline swgaweather

  • Member
  • *
  • Posts: 14
    • SWGA Weather Inc
Need assistance setting AWN to my Saratoga Template
« on: October 23, 2018, 07:15:42 PM »
My website is www.swgaweather.com and need assistance in getting my Ambient Weather data to show up on sight. I have inserted the API key and my Device ID. I know I'm leaving something out but dont know where. Also, having the files in /wx/ folder can someone show me how to get a index.html file that will redirect my files to show up when someone types in my web address vs mysite/wx/index.php

I appreciate in advance.

Offline ea1hmy

  • Contributor
  • ***
  • Posts: 120
    • meteotorrelavega
Re: Need assistance setting AWN to my Saratoga Template
« Reply #1 on: October 24, 2018, 06:52:34 AM »
Copy the attached index to your root in the ftp before / wx

remove .txt

have configured Settings-weather.php?
« Last Edit: October 24, 2018, 12:01:23 PM by ea1hmy »

Offline PaulMy

  • Forecaster
  • *****
  • Posts: 5519
    • KomokaWeather
Re: Need assistance setting AWN to my Saratoga Template
« Reply #2 on: October 24, 2018, 09:33:20 AM »
Not sure if it is a date format issue or something else http://www.swgaweather.com/wx/wxstatus.php  I don't use the Ambient so hopefully Ken or someone else will chyme in. 


Running http://www.swgaweather.com/wx/check-fetch-times.php?show=versions and www.swgaweather.com/wx/check-fetch-times.php shows everything is current

Enjoy,
Paul


Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Need assistance setting AWN to my Saratoga Template
« Reply #3 on: October 24, 2018, 12:33:29 PM »
The issue seems to be with his webserver's DNS lookup for api.ambientweather.net.  Running a view-source on AWNtags.php?sce=dump shows
Quote
<!-- AWNtags.php - Version 1.05 - 06-Aug-2018 -->
<!-- AWNtags.php - fetching current data JSON -->
<!-- curl fetching 'https://api.ambientweather.net/v1/devices/?applicationKey=*****&apiKey=27dc75b7faaf4351b47f817b6d682ebbdedcd667efbb4135bcd36e65d2f9e717' -->
<!-- HTTP stats:  RC=0 dest= port=0 (from sce=)
      Times: dns=0.077 conn=0.000 pxfer=0.000 get=0.044 total=0.044 secs -->
<!-- headers returned:

 -->
<!-- AWN_getJSON - RC=0 on try 1 - sleep(1) -->
<!-- curl fetching 'https://api.ambientweather.net/v1/devices/?applicationKey=*****&apiKey=27dc75b7faaf4351b47f817b6d682ebbdedcd667efbb4135bcd36e65d2f9e717' -->
<!-- HTTP stats:  RC=0 dest= port=0 (from sce=)
      Times: dns=0.000 conn=0.000 pxfer=0.000 total=0.000 secs -->
<!-- headers returned:

 -->
<!-- AWN_getJSON - RC=0 on try 2 - sleep(1) -->
<!-- curl fetching 'https://api.ambientweather.net/v1/devices/?applicationKey=*****&apiKey=27dc75b7faaf4351b47f817b6d682ebbdedcd667efbb4135bcd36e65d2f9e717' -->
<!-- HTTP stats:  RC=0 dest= port=0 (from sce=)
      Times: dns=0.000 conn=0.000 pxfer=0.000 total=0.000 secs -->
<!-- headers returned:

 -->
<!-- AWN_getJSON - RC=0 on try 3 - sleep(1) -->
<!-- AWN_getJSON - 3 tries - no joy -->
<!-- devices content len=0 bytes not saved. -->
<!-- pause 1 second to avoid 429 return on this fetch of detail data -->
<!-- curl fetching 'https://api.ambientweather.net/v1/devices/C0:21:0D:1E:EE:55?applicationKey=*****&apiKey=27dc75b7faaf4351b47f817b6d682ebbdedcd667efbb4135bcd36e65d2f9e717' -->
<!-- HTTP stats:  RC=0 dest= port=0 (from sce=)
      Times: dns=0.000 conn=0.000 pxfer=0.000 total=0.000 secs -->
<!-- headers returned:

 -->
<!-- AWN_getJSON - RC=0 on try 1 - sleep(1) -->
<!-- curl fetching 'https://api.ambientweather.net/v1/devices/C0:21:0D:1E:EE:55?applicationKey=*****&apiKey=27dc75b7faaf4351b47f817b6d682ebbdedcd667efbb4135bcd36e65d2f9e717' -->
<!-- HTTP stats:  RC=0 dest= port=0 (from sce=)
      Times: dns=0.000 conn=0.000 pxfer=0.000 total=0.000 secs -->
<!-- headers returned:

 -->
<!-- AWN_getJSON - RC=0 on try 2 - sleep(1) -->
<!-- curl fetching 'https://api.ambientweather.net/v1/devices/C0:21:0D:1E:EE:55?applicationKey=*****&apiKey=27dc75b7faaf4351b47f817b6d682ebbdedcd667efbb4135bcd36e65d2f9e717' -->
<!-- HTTP stats:  RC=0 dest= port=0 (from sce=)
      Times: dns=0.000 conn=0.000 pxfer=0.000 total=0.000 secs -->
<!-- headers returned:

 -->
<!-- AWN_getJSON - RC=0 on try 3 - sleep(1) -->
<!-- AWN_getJSON - 3 tries - no joy -->
<p>Warning: ambientweather.net data fetch unsuccessful.</p>

The dest= is blank (indicating that the DNS lookup was unsuccessful by curl)..  It's a webhoster tech support issue to fix.
His other settings for AWN are ok (and work fine on my test site).
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Need assistance setting AWN to my Saratoga Template
« Reply #4 on: October 24, 2018, 01:25:02 PM »
You can try this script (I called it dns-test.php) on your site.  It will show additional info about the DNS lookup for api.ambientweather.net

Code: [Select]
<?php
header
("Content-type: text/html,charset=ISO-8859-1");

print 
"<pre>\n";
$lookup 'api.ambientweather.net';
print 
"PHP ".phpversion()."\n";

$dnsFile '/etc/resolv.conf';

if(
is_readable($dnsFile)) {
print "$dnsFile server file found.  Contents:\n";
print "------------------\n";
readfile($dnsFile);
print "------------------\n";
} else {
print "Note: $dnsFile file not found or is not readible.\n";
}

print 
"..doing gethostbyname('$lookup'); \n";
error_reporting(E_ALL);
$ipAddr gethostbyname($lookup);
print 
"Returned IP='$ipAddr' for '$lookup'\n";
print 
"</pre>\n";

if(isset(
$_REQUEST['info']) and $_REQUEST['info']='yes') {
print phpinfo();
}

Let me know when it's installed and what the URL is and I'll give the results a look.  It should show:
Quote
PHP  5.6.38
Note: /etc/resolv.conf file not found.
..doing gethostbyname('api.ambientweather.net');
Returned IP='107.170.198.71' for 'api.ambientweather.net'
on your site.
« Last Edit: October 24, 2018, 01:30:27 PM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline swgaweather

  • Member
  • *
  • Posts: 14
    • SWGA Weather Inc
Re: Need assistance setting AWN to my Saratoga Template
« Reply #5 on: October 24, 2018, 03:18:03 PM »
What page do I put this on? The home page? Do I put it in between which brackets? I just tried putting it in and crashed my site and took it out and now it works.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Need assistance setting AWN to my Saratoga Template
« Reply #6 on: October 24, 2018, 03:25:28 PM »
It would be on a new page named dns-test.php -- just the stuff in the code box above is all that is required for that new page.

Inserting it in an existing page is not recommended.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9279
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Need assistance setting AWN to my Saratoga Template
« Reply #7 on: October 24, 2018, 03:30:22 PM »
looks like you've located the issue .. an outbound connection firewall needed permissions to access api.ambientweather.net.

Now your data is being retrieved successfully
Quote
<!-- AWNtags.php - Version 1.05 - 06-Aug-2018 -->
<!-- AWNtags.php - fetching current data JSON -->
<!-- curl fetching 'https://api.ambientweather.net/v1/devices/?applicationKey=*****&apiKey=27dc75b7faaf4351b47f817b6d682ebbdedcd667efbb4135bcd36e65d2f9e717' -->
<!-- HTTP stats:  RC=200 dest=107.170.198.71 port=443 (from sce=208.117.46.143)
      Times: dns=0.067 conn=0.129 pxfer=0.427 get=0.079 total=0.506 secs -->
<!-- devices file ./cache/ambientweather.net.9ff61677266af9ee8e8b793307c44e5b.devices.json saved. 543 bytes. -->
<!-- AWN device C0:21:0D:1E:EE:55 info='South Georgia Skywarn Spottersg   SWGA Office' -->
<!-- AWNtags.php (./cache/ambientweather.net.C0210D1EEE55.json)
  cache time   = 2018-10-24T15:22:00-04:00 from unix time 1540408920
  current time = 2018-10-24T15:23:22-04:00 from unix time 1540409002
  difference   = 82 (seconds)
  diff allowed = 60 (seconds) -->
<!-- AWNtags.php: data to old, will be loaded from url  -->
<!-- pause 1 second to avoid 429 return on this fetch of detail data -->
<!-- curl fetching 'https://api.ambientweather.net/v1/devices/C0:21:0D:1E:EE:55?applicationKey=*****&apiKey=27dc75b7faaf4351b47f817b6d682ebbdedcd667efbb4135bcd36e65d2f9e717' -->
<!-- HTTP stats:  RC=200 dest=107.170.198.71 port=443 (from sce=208.117.46.143)
      Times: dns=0.000 conn=0.062 pxfer=0.196 get=0.613 total=0.810 secs -->
<!-- saved ./cache/ambientweather.net.C0210D1EEE55.json 119695 bytes -->
<!-- AWNtags.php processing most current lastData for C0:21:0D:1E:EE:55 -->
...
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

 

anything