I have added a new sample PHP application to the Example Code section of my website. This application queries the NASA Astronomy Picture of the Day (APOD) Open API, bringing stunning space imagery and insightful information daily.
The new application can be found at the following URL:
https://www.mikewilcock.com/example-code/tools-and-utilities/nasa-astronomy-picture-of-the-day/
Overview
This web app is built using PHP 8.1 and utilizes the PHP cURL function to fetch data from the NASA APOD API. Here’s a summary of the data returned by NASA’s APOD API:
- resource: Describes the image_set or planet illustrated.
- concept_tags: Reflects the supplied option.
- title: The title of the image.
- date: Date of the image.
- url: URL of the APOD image or video of the day.
- hdurl: URL for any high-resolution image of the day.
- media_type: Type of media (image or video).
- explanation: Text explanation of the image.
- concepts: Relevant concepts within the explanation (if concept_tags is true).
- thumbnail_url: Thumbnail URL of the video.
- copyright: Name of the copyright holder.
- service_version: Service version used.
My sample application displays the returned API data in a formatted HTML web form, along with a thumbnail view of the picture of the day. You can view the APOD image in full resolution by clicking the thumbnail. As with all applications in my web framework, this sample app links to a fully indexed and searchable context-sensitive HTML help system.
Summary
It is my plan in the future to implement more sample apps which make calls to some of the other NASA Open API’s. In the near future I may also add a print button to the APOD application toolbar, which links to my report viewer component and displays the API information in a printable / exportable report format.
For the time being though this application serves as a working example of integration between a free, open API and my bespoke web application framework.