Author Topic: Purple Air Script Stopped Working  (Read 559 times)

0 Members and 1 Guest are viewing this topic.

Offline satcop

  • Senior Contributor
  • ****
  • Posts: 241
    • Clifton Virginia Weather
Purple Air Script Stopped Working
« on: July 25, 2019, 08:31:48 PM »
Well it appears something changed in the last few days.  A script that I was using for about 6 months to retrieve my purpleair aqi is now giving a warning and has broke. :sad: Receiving this warning message Warning: file_get_contents(http://www.purpleair.com/json?show=16378): failed to open stream: HTTP request failed! HTTP/1.0 500 Internal Server Error.    I checked a couple of other scripts on other sites that used the same base and some of them are getting the same error. My page is https://cliftonvaweather.com/wx-purpleair.php  This error is also showing on a similar get-aqi-rss-with-link.php script.  I tried changing the file being retrieved url to https: but that didn't fix the issue.  Any suggestions would be most appreciated.

Bob
« Last Edit: July 25, 2019, 08:33:28 PM by satcop »
Clifton, Virginia Weather


Blitzortung Stations 1189, 1451 - CWOP EW1675

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: Purple Air Script Stopped Working
« Reply #1 on: July 25, 2019, 10:03:29 PM »
Looks like they may have gone 'secure'.

Try this non-curl example with the https url ...
Code: [Select]
$url= 'https://example.com';

$arrContextOptions=array(
      "ssl"=>array(
            "verify_peer"=>false,
            "verify_peer_name"=>false,
        ),
    ); 

$response = file_get_contents($url, false, stream_context_create($arrContextOptions));

... from stack overflow https://stackoverflow.com/questions/1975461/how-to-get-file-get-contents-to-work-with-https
Imagine what you will KNOW tomorrow !

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9277
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Purple Air Script Stopped Working
« Reply #2 on: July 26, 2019, 12:17:59 PM »
The PurpleAir servers were having issues the last couple of days -- a 500-Server Error is a problem with their servers, not with the request.

The PurpleAir servers seem to be working ok today. 
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 satcop

  • Senior Contributor
  • ****
  • Posts: 241
    • Clifton Virginia Weather
Re: Purple Air Script Stopped Working
« Reply #3 on: July 27, 2019, 10:50:57 AM »
Thanks folks, while it wasn't working yesterday, it is working again today :-).  I will monitor, and if necessary do to any possible changes on Purpleair's end will try some fixes, but for right now I will let it ride.
Clifton, Virginia Weather


Blitzortung Stations 1189, 1451 - CWOP EW1675

 

anything