WXforum.net

Weather Station Hardware => Weather Web Cams => Bloomsky Sky Camera+sensors => Topic started by: Jáchym on March 05, 2016, 09:54:35 AM

Title: PHP script - Get the latest BloomSky image
Post by: Jáchym on March 05, 2016, 09:54:35 AM
Hi guys,
I have seen several people already asking about how to get the latest BloomSky image. Since it is a dynamic URL it is not as easy, so I created a little script which will do it for you.

Instructions:
1. Download the attached PHP file
2. Open the file in a text editor and insert your API key - if you don't have one, you need to get one for free from the official BloomSky developer's site
3. Upload the file anywhere on your server
4. For the image source on your page, use this php file.

eg:
<img src="...../bloomSkyLatest.php">

It should work, but since I cannot test properly because I dont have the camera, I would appreciate if someone could confirm it.

Enjoy
Title: Re: PHP script - Get the latest BloomSky image
Post by: Bob3rd on March 05, 2016, 10:06:19 AM
I see two zipped PHP files with the same name.  For some reason I am unable to download either of them even though I am logged in to the forum. Perhaps it is a forum issue. .....(update)...now it works.  Thanks.  I am going to tinker with it a bit now.
Title: Re: PHP script - Get the latest BloomSky image
Post by: PaulMy on March 05, 2016, 10:13:10 AM
Funny, just last night I looked if I could do something like that - but I couldn't :oops:
 
Have downloaded the zip (I think the latest when only one was showing) and get this http://www.komokaweather.com/bloomsky/bloomSkyLatest.php (http://www.komokaweather.com/bloomsky/bloomSkyLatest.php)
 
Did I miss something
 
Paul
Title: Re: PHP script - Get the latest BloomSky image
Post by: Jáchym on March 05, 2016, 10:17:50 AM
I checked the link Paul and I see an image of your snowy street, so I dont see any problems with it
Title: Re: PHP script - Get the latest BloomSky image
Post by: PaulMy on March 05, 2016, 10:23:43 AM
Hmm, with that link I get
Quote
<br /> <b>Warning</b>:  file_get_contents(https://api.bloomsky.com/api/skydata): failed to open stream: HTTP request failed! HTTP/1.0 401 Unauthorized in <b>/home/content/96/5379896/html/bloomsky/bloomSkyLatest.php</b> on line <b>22</b><br /> <br /> <b>Warning</b>:  file_get_contents(): Filename cannot be empty in <b>/home/content/96/5379896/html/bloomsky/bloomSkyLatest.php</b> on line <b>28</b><br /> 

At least you know the script is correct.  Now to find what is different for me ](*,)
 
Regards,
Paul
Title: Re: PHP script - Get the latest BloomSky image
Post by: Bob3rd on March 05, 2016, 10:40:14 AM
I'm getting an error message too.  My link is http://bbbrown.com/pages/bloomSkyLatest.php .  I used 
Code: [Select]
<img src="http://bbbrown.com/pages/bloomSkyLatest.php"></img> in my web page.  I put my API in the script in the appropriate place I think,  Could this be a conflict with Wordpress?
Title: Re: PHP script - Get the latest BloomSky image
Post by: Jáchym on March 05, 2016, 10:47:15 AM
Strange...

(http://i67.tinypic.com/5oxhjq.png)
Title: Re: PHP script - Get the latest BloomSky image
Post by: wvdkuil on March 05, 2016, 10:48:18 AM
I'm getting an error message too.  My link is http://bbbrown.com/pages/bloomSkyLatest.php .  I used 
Code: [Select]
<img src="http://bbbrown.com/pages/bloomSkyLatest.php></img> in my web page.  I put my API in the script in the appropriate place I think,  Could this be a conflict with Wordpress?
There is  an " missing after  the link in your example code
Code: [Select]
<img src="http://bbbrown.com/pages/bloomSkyLatest.php"></img>Check if that is there, it should be.
Wim
Title: Re: PHP script - Get the latest BloomSky image
Post by: Jáchym on March 05, 2016, 10:48:24 AM
I'm getting an error message too.  My link is http://bbbrown.com/pages/bloomSkyLatest.php .  I used 
Code: [Select]
<img src="http://bbbrown.com/pages/bloomSkyLatest.php></img> in my web page.  I put my API in the script in the appropriate place I think,  Could this be a conflict with Wordpress?

You are missing the end quotation mark in your src

<img src="http://bbbrown.com/pages/bloomSkyLatest.php"></img>
Title: Re: PHP script - Get the latest BloomSky image
Post by: Bob3rd on March 05, 2016, 10:49:58 AM
Sorry.  That was a typo when I was creating the post.  The end quote is there on the page.
Title: Re: PHP script - Get the latest BloomSky image
Post by: Jáchym on March 05, 2016, 10:54:48 AM
Hmm I see two possibilities:

- your server does not allow external file_get_contents commands
- your API key is not working

You can PM me your API and I will test it on my server if you want
Title: Re: PHP script - Get the latest BloomSky image
Post by: Bob3rd on March 05, 2016, 10:58:59 AM
PM sent.
Title: Re: PHP script - Get the latest BloomSky image
Post by: Jáchym on March 05, 2016, 11:01:49 AM
Yes, I just tried and it works on my end.

Lets take it step by step,
try using this script first, let me know if it helped:
Code: [Select]
header('Content-type: image/png');

$APIkey = "";
$url = "https://api.bloomsky.com/api/skydata";

$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Authorization: ".$APIkey."\r\n"
)
);
$context = stream_context_create($opts);
$file = curl_get_contents($url, false, $context);

$data = json_decode($file, true);

$imageURL = $data[0]['Data']['ImageURL'];

echo curl_get_contents(  $imageURL );

function curl_get_contents($url){
$ch = curl_init();
//curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0");
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
Title: Re: PHP script - Get the latest BloomSky image
Post by: wvdkuil on March 05, 2016, 11:08:52 AM
@jachym @Bob3rd @PaulMy
I enclose the smallest testscript to see what the errors are.
As the browser call works the error is in his script to load the image @Bob3rd, same as for @PaulMy

If they use this => and the image displays then they should check their scripts with the <img /> tag again.

Code: [Select]
<?php ini_set('display_errors''On');   error_reporting(E_ALL);
?>

<img src="./bloomSkyLatest.php">

Wim

Title: Re: PHP script - Get the latest BloomSky image
Post by: Bob3rd on March 05, 2016, 11:11:32 AM
Okay.  I placed it at http://bbbrown.com/weather/bloomsky-php-script-test/ (http://bbbrown.com/weather/bloomsky-php-script-test/) .  The page loads with no error but there is a ghost image icon instead of the real thing.
Title: Re: PHP script - Get the latest BloomSky image
Post by: Jáchym on March 05, 2016, 11:14:05 AM
Thanks Wim,

in Paul's case though I dont understand the problem because it works when I try his link, I dont understand how can he get a different output from the server when he loads it in his browser... in Bob's case it obviously is due to the server configuration, but how can Paul's link work in my browser and not his. ](*,)
Title: Re: PHP script - Get the latest BloomSky image
Post by: wvdkuil on March 05, 2016, 11:19:16 AM
Thanks Wim,

in Paul's case though I dont understand the problem because it works when I try his link, I dont understand how can he get a different output from the server when he loads it in his browser... in Bob's case it obviously is due to the server configuration, but how can Paul's link work in my browser and not his. ](*,)
When these scripts are called in the browser,
http://bbbrown.com/pages/bloomSkyLatest.php
http://www.komokaweather.com/bloomsky/bloomSkyLatest.php
they are executed on their server.  They run Ok, so your script is OK.

When there is an error it is in their script with the <img tag,  it is inside their script, not inside your script
Wim
Title: Re: PHP script - Get the latest BloomSky image
Post by: wvdkuil on March 05, 2016, 11:23:01 AM
Okay.  I placed it at http://bbbrown.com/weather/bloomsky-php-script-test/ (http://bbbrown.com/weather/bloomsky-php-script-test/) .  The page loads with no error but there is a ghost image icon instead of the real thing.
What did you place where.
The test-img.php script should be in the same folder as the bloomSkyLatest.php script.
Just to see the errors when executing.
Wim
Title: Re: PHP script - Get the latest BloomSky image
Post by: Bob3rd on March 05, 2016, 11:23:57 AM
I think I will contact my hosting service to find out if they support PHP and which version they support.  When I ran your original script just by pointing my browser directly to the file, I got an error that said it could not load the image because the image contained errors.  That was the closest to success I got.
Title: Re: PHP script - Get the latest BloomSky image
Post by: Bob3rd on March 05, 2016, 11:24:49 AM
Okay.  I placed it at http://bbbrown.com/weather/bloomsky-php-script-test/ (http://bbbrown.com/weather/bloomsky-php-script-test/) .  The page loads with no error but there is a ghost image icon instead of the real thing.
What did you place where.
The test-img.php script should be in the same folder as the bloomSkyLatest.php script.
Just to see the errors when executing.
Wim
Oh. sorry I didn't know that.  I'll move it and try again.
Title: Re: PHP script - Get the latest BloomSky image
Post by: PaulMy on March 05, 2016, 11:28:30 AM
Thanks Wim,
Yes that test-img.php did work and shows the BloomSky latest.  I then added your suggested code in my www.komokaweather.com (http://www.komokaweather.com) page and it displays there now.
 
Before I added that code I did enter that URL www.komokaweather.com/bloomsky/bloomSkyLatest.php (http://www.komokaweather.com/bloomsky/bloomSkyLatest.php) and then it also displayed.  Earlier I had tried it a dozen or more times all with that same error message.  Maybe a cache thing or something.  But all looks good now.
 
Again thanks Wim, and Jachym.
 
Paul
 
Title: Re: PHP script - Get the latest BloomSky image
Post by: ke9lz on March 05, 2016, 11:36:23 AM
Hi Jachym,  Thanks for sharing the script!  I have been trying to figure a way to just get the current image using web cam software and this works great!  I put your script on my web server and then using Imagesalsa I call that script to get the latest image.  From there I can manipulate the image and then upload it up to may server.  Here is the result http://weather.athelstanewi.com/wxbloom.php (http://weather.athelstanewi.com/wxbloom.php).  Now I can add it along with my other webcam images.  Cool stuff!
Title: Re: PHP script - Get the latest BloomSky image
Post by: Bob3rd on March 05, 2016, 11:37:19 AM
If I point my browser directly to http://www.bbbrown.com/test-image.php (http://www.bbbrown.com/pages/test-image.php) the text of the script is returned to me.  I'm not a programmer so it might be me causing the problem.
Title: Re: PHP script - Get the latest BloomSky image
Post by: Bob3rd on March 05, 2016, 11:42:56 AM
Just to recap.  I edited the original BloomskyLatest.php and added my API.  It didn't work.  I sent you my API key and it worked using your server.

You sent the minimal test-image.php script which I placed in the same folder as the above script.  When I point my browser to that I only get the text of the script returned.  Probably because I don't know what I am doing.
Title: Re: PHP script - Get the latest BloomSky image
Post by: wvdkuil on March 05, 2016, 11:49:41 AM
Just to recap.  I edited the original BloomskyLatest.php and added my API.  It didn't work.  I sent you my API key and it worked using your server.

You sent the minimal test-image.php script which I placed in the same folder as the above script.  When I point my browser to that I only get the text of the script returned.  Probably because I don't know what I am doing.
No sir, it is the strange behavior of some webservers and some assisting programs when uploading.
Please use a decent FTP program to upload both jachyms script and mine again.
Put the in a new folder to be sure that there is nothing else disturbing things.
Why? Because some extra html is enclosing the scripts. This is the html source of  http://www.bbbrown.com/test-image.php
Code: [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta http-equiv="Content-Style-Type" content="text/css">
  <title></title>
  <meta name="Generator" content="Cocoa HTML Writer">
  <meta name="CocoaVersion" content="1404.34">
  <style type="text/css">
    p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #454545}
  </style>
</head>
<body>
<p class="p1">&lt;?php ini_set('display_errors', 'On');   error_reporting(E_ALL);</p>
<p class="p1">?&gt;</p>
<p class="p1">&lt;img src="./bloomSkyLatest.php"&gt;</p>
</body>
</html>
So probably you are uploading this using a WYSIWG editor Cocoa HTML Writer.

You should ONLY upload the scripts by a plain FTP program.
Nothing else should be added.

Wim
Title: Re: PHP script - Get the latest BloomSky image
Post by: Bob3rd on March 05, 2016, 11:50:48 AM
Oh.  I am so sorry.  I'll have to find a plain text editor for my Mac.  My apologies.
Title: Re: PHP script - Get the latest BloomSky image
Post by: Bob3rd on March 05, 2016, 12:38:53 PM
It does appear that the .htaccess file in my public_html folder is configured for a local Wordpress instance which I use for my web site.  I will contact my hosting service to find a work around so I can run PHP files.  Thanks for your patience and help.
Title: Re: PHP script - Get the latest BloomSky image
Post by: Maumelle Weather on March 05, 2016, 01:15:59 PM
Hi Jachym,

Works just fine here (http://www.sacrey.info/wxbloomsky.php).

Thanks for taking the time to create this.

John
Title: Re: PHP script - Get the latest BloomSky image
Post by: Jáchym on March 05, 2016, 01:53:52 PM
Great :-) At least for someone it works :D

OT: John is your website down? It throws a server error when I click the link in your profile
Title: Re: PHP script - Get the latest BloomSky image
Post by: Maumelle Weather on March 05, 2016, 02:12:34 PM
Website isn't down. I may need to change the URL. Started using Cloudflare yesterday. Hang on a sec.

Please try again. Working for me.
Title: Re: PHP script - Get the latest BloomSky image
Post by: Jáchym on March 05, 2016, 05:10:58 PM
 \:D/
Title: Re: PHP script - Get the latest BloomSky image
Post by: Bob3rd on March 07, 2016, 02:38:51 PM
Hi Jachym,

Did a little follow up and found that if I place a simple hello script in my public_html folder and call it with http://www.bbbrown.com/Bloomsky/hello.php I get a 404 error.  If I call it with http://bbbrown.com/Bloomsky/hello.php I get the proper response.  Having done that I then called the latest image using your script with http://bbbrown.com/Bloomsky/bloomSkyLatest.php I get a "unable to display the image "http://bbbrown.com/Bloomsky/bloomSkyLatest.php" cannot be displayed because it contains errors.  I think this is progress.  What do you think?

Also, you can see the PHP configuration of my server at http://bbbrown.com/phpinfo.php
Title: Re: PHP script - Get the latest BloomSky image
Post by: chrisgrainger on March 07, 2016, 04:03:31 PM
Hi Jachym,

Thanks very much for the BloomSky latest image script.  Working fine here.  http://www.rideauwx.info/wxLatestBloomsky.php

Cheers!

Chris
Title: Re: PHP script - Get the latest BloomSky image
Post by: Bob3rd on March 14, 2016, 03:23:04 PM
I have not resolved my issue but I have been able to run the script that retrieves the latest image enough to get an error about the image. The URL http://bbbrown.com/Bloomsky/bloomSkyLatest.php returns an error image.
(http://www.bbbrown.com/Bloomsky/ImageError.png)
The error above continues with ....because it contains errors.
So, the script seems to be running correctly. I have checked my API key for the weather station and it is correct. Other people are able to run the script using their key and they are successful.  Any ideas?
Here's the code:
Code: [Select]
<?php

// get the latest BloomSky Image file
// fill in your API key and point your image src to this file

// Jachym, meteotemplate.com


header('Content-type: image/png');

ini_set("include_path"'/home/bbbrow5/php:' ini_get("include_path")  );


$APIkey "seCtg8zXqubZrNtntrHF2c0="// your API key

$url "https://api.bloomsky.com/api/skydata";

$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Authorization: ".$APIkey."\r\n"
)
);
$context stream_context_create($opts);
$file file_get_contents($urlfalse$context);

$data json_decode($filetrue);

$imageURL $data[0]['Data']['ImageURL'];

echo file_get_contents(  $imageURL );

?>
Title: Re: PHP script - Get the latest BloomSky image
Post by: VaJim on March 14, 2016, 07:04:34 PM
Hi guys,
I have seen several people already asking about how to get the latest BloomSky image. Since it is a dynamic URL it is not as easy, so I created a little script which will do it for you.

Instructions:
1. Download the attached PHP file
2. Open the file in a text editor and insert your API key - if you don't have one, you need to get one for free from the official BloomSky developer's site
3. Upload the file anywhere on your server
4. For the image source on your page, use this php file.

eg:
<img src="...../bloomSkyLatest.php">

It should work, but since I cannot test properly because I dont have the camera, I would appreciate if someone could confirm it.

Enjoy


Nice work!

I only wish you were around back in the day when I pushed my data to my weather page.

Thanks for helping.
Title: Re: PHP script - Get the latest BloomSky image
Post by: Jáchym on March 14, 2016, 07:10:06 PM
Hi guys,
I have seen several people already asking about how to get the latest BloomSky image. Since it is a dynamic URL it is not as easy, so I created a little script which will do it for you.

Instructions:
1. Download the attached PHP file
2. Open the file in a text editor and insert your API key - if you don't have one, you need to get one for free from the official BloomSky developer's site
3. Upload the file anywhere on your server
4. For the image source on your page, use this php file.

eg:
<img src="...../bloomSkyLatest.php">

It should work, but since I cannot test properly because I dont have the camera, I would appreciate if someone could confirm it.

Enjoy


Nice work!

I only wish you were around back in the day when I pushed my data to my weather page.

Thanks for helping.

Thanks :)


Bob3rd:
The only other thing I can think of is that there is some kind of firewall installed on your server which restricts the script from connecting to the BloomSky Api
Title: Re: PHP script - Get the latest BloomSky image
Post by: Bob3rd on March 14, 2016, 07:23:59 PM
I'm trying to discover the problem with my provider.  If we figure it out I will post here.  It has to do with the image.  The script runs.  So, there must be some restriction on retrieving the image.
Title: Re: PHP script - Get the latest BloomSky image
Post by: Bob3rd on March 14, 2016, 08:28:44 PM
Problem solved.  Turned out to be the version of PHP running on my server.  I changed from 5.3 to 5.5 and everything works now. 
Title: Re: PHP script - Get the latest BloomSky image
Post by: Jáchym on March 14, 2016, 08:50:16 PM
 \:D/
Title: Re: PHP script - Get the latest BloomSky image
Post by: thewxobserver on March 19, 2016, 02:41:55 PM
Thanks for the script it has solved a problem of pulling the latest image for the website I am working on. Just a quick question is there a way to pull the image with the weather data from bloomsky on top?
Title: Re: PHP script - Get the latest BloomSky image
Post by: SpringHillWeather on March 22, 2016, 10:01:05 PM
Thanks for the script it has solved a problem of pulling the latest image for the website I am working on. Just a quick question is there a way to pull the image with the weather data from bloomsky on top?
The data that is over-layed on the image is pulled from the Api. 
There is a simple website template posted here showing how it's done.
http://www.wxforum.net/index.php?topic=28635.0
Title: Re: PHP script - Get the latest BloomSky image
Post by: SpringHillWeather on March 22, 2016, 10:02:26 PM
Thanks for the script it has solved a problem of pulling the latest image for the website I am working on. Just a quick question is there a way to pull the image with the weather data from bloomsky on top?
The data that is over-layed on the image is pulled from the Api. 
There is a simple website template posted here showing how it's done.
http://www.wxforum.net/index.php?topic=28635.0
 (http://www.wxforum.net/index.php?topic=28635.0)
Title: Re: PHP script - Get the latest BloomSky image
Post by: kirklabs on March 30, 2016, 11:10:22 PM
Hey there Jachym (or anyone else who sees this) - noob question here...

Thanks for providing this!! I got the script installed and a link to the php image works fine (as in http://www.kirklabs.com/weather/smartphone/icons/bloomSkyLatest.php )

WeatherUnderground wants me to either ftp an image file or link to the URL of an image file for purposes of displaying a webcam image. It will not accept a link to a php file. I am not a developer so I might be missing something, but in the example above, how would I get a link to the actual .png image file?

JD
Title: Re: PHP script - Get the latest BloomSky image
Post by: hankster on March 30, 2016, 11:29:22 PM
Use FTP, the Bloomsky is already setup to do that.
Title: Re: PHP script - Get the latest BloomSky image
Post by: PaulMy on March 30, 2016, 11:46:13 PM
You would need to use this https://wunderground-1112.appspot.com/uploader/login/


Paul
Title: Re: PHP script - Get the latest BloomSky image
Post by: Jáchym on March 31, 2016, 05:00:55 AM
Use the method suggested above. As far as I know there is no other way. The way this works is that in PHP you can set the headers, which define what sort of file type it will look like to the browser. So in the above script, you set the headers to JPG or PNG and the browser then things it is an image even though it is in fact a PHP script, which creates the image. The problem is however, that if you give it the png extension it will automatically be treated as an image, the server will not try to execute it and run the code, it will simply use the actual code as image data, which wouldn´t work.
Title: Re: PHP script - Get the latest BloomSky image
Post by: SpringHillWeather on March 31, 2016, 12:44:37 PM
Hey there Jachym (or anyone else who sees this) - noob question here...

Thanks for providing this!! I got the script installed and a link to the php image works fine (as in http://www.kirklabs.com/weather/smartphone/icons/bloomSkyLatest.php )

WeatherUnderground wants me to either ftp an image file or link to the URL of an image file for purposes of displaying a webcam image. It will not accept a link to a php file. I am not a developer so I might be missing something, but in the example above, how would I get a link to the actual .png image file?

JD

I'm almost positive I use the bloomSkyLatest.php as my image link and it works.
I'll have to double check.


Update: I checked WU and I am using the bloomSkyLatest.php file as my image and its working.
Title: Re: PHP script - Get the latest BloomSky image
Post by: mkutche on October 17, 2016, 06:26:27 PM
Hi Jachym,  Thanks for sharing the script!  I have been trying to figure a way to just get the current image using web cam software and this works great!  I put your script on my web server and then using Imagesalsa I call that script to get the latest image.  From there I can manipulate the image and then upload it up to may server.  Here is the result http://weather.athelstanewi.com/wxbloom.php (http://weather.athelstanewi.com/wxbloom.php).  Now I can add it along with my other webcam images.  Cool stuff!

How did you add N S E W and the current timestamp?? Looks awesome
Title: Re: PHP script - Get the latest BloomSky image
Post by: ke9lz on October 17, 2016, 07:13:12 PM
Hi Mike,  I use Imagesalsa to download the picture, add the N S E W as well as the time stamp and then upload it to the server.  It's to bad Imagesalsa is outdated and hasn't kept up with the times but in it's day it was I think the best webcam software out there.  You can still download it and it's free now at http://www.imagesalsa.com/ (http://www.imagesalsa.com/).
Title: Re: PHP script - Get the latest BloomSky image
Post by: vnephologist on May 03, 2017, 09:53:52 PM
Jáchym, I'm thinking of hosting the script on my Meteobridge and then pointing the webcam image upload config url to localhost. I'm pretty sure the Meteobridge url parameter is expecting only an image to be returned, not html with an image. Planning to work on this soon. Any tips? Thanks!
Title: Re: PHP script - Get the latest BloomSky image
Post by: vnephologist on May 08, 2017, 08:38:47 PM
Guess I should've taken a look at the script before I posted. It works exactly the way I needed out of the box. In fact, I was able to easily create an Azure web app and point Meteobridge to it for upload to WU every 5 minutes. It seems to work much better for WU playback than Bloomsky native integration with WU (I could never get WU time lapse video to work with the native integration). If anyone else is interested, I could modify the script to accept an API key as a querystring in the URL so anyone could use.
Title: Re: PHP script - Get the latest BloomSky image
Post by: Jáchym on May 08, 2017, 08:40:35 PM
:)
Title: Re: PHP script - Get the latest BloomSky image
Post by: captainjackfan58 on May 20, 2020, 01:11:15 PM
Does anyone have this .php script yet trying to get a copy of it bloomskyLatest.php  .zip file
Title: Re: PHP script - Get the latest BloomSky image
Post by: mkutche on November 28, 2021, 11:35:46 AM
hate to bring up an old topic but http://gosportwx.com/bloomSkyLatest.php doesn't work for me.. it use to with godaddy but not with fatcow host. Latest PHP version of new server is 7.3, and that isn't the issue.
Title: Re: PHP script - Get the latest BloomSky image
Post by: davidefa on November 28, 2021, 11:50:14 AM
'The image contains errors'

To understand what's going wrong you need to look in the error log
Alternatively you may temporarily comment out these 3 lines that should be near the end of the bloomSkyLatest.php script ( doing this the errors should be printed in the browser )

Code: [Select]
header("Content-type: image/png");
imagepng($im);
imagedestroy($im);
Title: Re: PHP script - Get the latest BloomSky image
Post by: mkutche on November 28, 2021, 11:56:37 AM
'The image contains errors'

To understand what's going wrong you need to look in the error log
Alternatively you may temporarily comment out these 3 lines that should be near the end of the bloomSkyLatest.php script ( doing this the errors should be printed in the browser )

Code: [Select]
header("Content-type: image/png");
imagepng($im);
imagedestroy($im);

in my FTP folder i dont see an error log
Title: Re: PHP script - Get the latest BloomSky image
Post by: wvdkuil on November 28, 2021, 11:58:06 AM
hate to bring up an old topic but http://gosportwx.com/bloomSkyLatest.php doesn't work for me.. it use to with godaddy but not with fatcow host. Latest PHP version of new server is 7.3, and that isn't the issue.
Code: [Select]
br />
<b>Warning</b>:  file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in <b>/hermes/walnacweb03/walnacweb03aa/b1007/moo.cyrptoworldnet/Gosportwx/bloomSkyLatest.php</b> on line <b>22</b><br />
<br />
<b>Warning</b>:  file_get_contents(https://api.bloomsky.com/api/skydata): failed to open stream: no suitable wrapper could be found in <b>/hermes/walnacweb03/walnacweb03aa/b1007/moo.cyrptoworldnet/Gosportwx/bloomSkyLatest.php</b> on line <b>22</b><br />


Your providers-PHP settings  do not allow loading outside files using the PHP function file_get_contents()
==> " wrapper is disabled in the server configuration"
Therefor the script can not load the image from Bloomsky
==> "file_get_contents(https://api.bloomsky.com/api/skydata): failed"

Ask your provider support person which setting in cPanel or similar you have to change to use that function.
Probably other scripts will also fail if this function is blocked.

Wim
Title: Re: PHP script - Get the latest BloomSky image
Post by: mkutche on November 28, 2021, 03:57:30 PM
got it working. Thanks.