This repository contains a simple PHP class for fetching and processing data from the Hangang API. The Hangang class provides methods to request data from the API, parse the response, and retrieve specific information about the Hangang.
- Uses the
file_get_contentsfunction to fetch data from the Hangang API. - Decodes the JSON response and provides a method to extract relevant information.
- Ensures that the data fetched from the API is in the expected format before processing.
-
Initialization
First, instantiate the
Hangangclass.$hangang = new Hangang();
-
Request Data
Use the
requestmethod to fetch data from the Hangang API.$hangang->request();
-
Retrieve Information
The
getInfomethod can be used to get parsed data from the Hangang API. This method returns an associative array containing the status, a message, cache metadata, and detailed data for different locations in Hangang.$info = $hangang->getInfo(); print_r($info);
The getInfo method ensures that the fetched data is in the expected format. If there's an issue with the API response, the method returns an error status and an error message.
This project is licensed under the MIT License