Skip to content

Try This API To Collect Zinc Rates Using PHP

If you need an API with zinc information using PHP, this post will be helpful to you.

The average annual zinc price in January 2022 was $3,599 per tonne, an increase of 6% from December 2021. Due to surplus market supply, the price is expected to fall 4% y/y to around $2,880 per tonne in 2022. In 2020, around 4.7 million tonnes of zinc were shipped globally, up 8.3% from the previous year.

Try This API To Collect Zinc Rates Using PHP

Because of all of these reasons, you should be aware that access to zinc rates may be critical to your company’s profitability. To access this information in PHP, an API, which is a user interface that exposes data acquired from a specific location, may be utilized. This gives you a large amount of data in a short period.

Which API Use PHP

PHP (Hypertext Preprocessor) is a general-purpose programming language used to create dynamic and interactive web pages. It was one of the first server-side languages to be integrated into HTML, making it easy to add functionality to webpages without relying on data from other files. It has advanced as a consequence of ongoing improvements that add new features and increase its capabilities.

PHP is not used by every API for data transport. As a result, we recommend that you use Metals-API, one of the most well-known and comprehensive APIs for precious metals pricing, to help you make investment decisions. This API allows you to monitor zinc rates in real-time as well as their fluctuations over time.

Try This API To Collect Zinc Rates Using PHP

Follow these procedures to receive your API key:

  1. You may get an API key at www.metals-API.com.
  2. On the website’s list, look for the zinc symbol (ZNC).
  3. Before utilizing the API, insert these metal and currency symbols on the list. You may also choose from a variety of programming languages and rate types, such as historical and spot pricing.
  4. Finally, hit the “Run” button to complete the process.

The API will display the following information:

// set API Endpoint and API key 
$endpoint = 'latest';
$access_key = 'API_KEY';

// Initialize CURL:
$ch = curl_init('https://metals-api.com/api/'.$endpoint.'?access_key='.$access_key.'');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Store the data:
$json = curl_exec($ch);
curl_close($ch);

// Decode JSON response:
$exchangeRates = json_decode($json, true);

// Access the exchange rate values, e.g. GBP:
echo $exchangeRates['rates']['GBP'];

Why Metals-API

Metals-API is visited regularly by thousands of developers, small businesses, and large enterprises. This API is used by many firms, including Barrick Gold, Chainlink, and Glencore. They may use this tool to quickly and simply determine the current international market value of any metal.

Metals-API is the most trustworthy source for real-time precious metals rates since it receives data every minute from roughly 15 renowned data sources, such as financial institutions. Real-time applications and software may be written in many programming languages, including JSON, Python, and PHP. There are more than 170 commodities and currencies to pick from.

Published inAppsApps, technologyTechnology
%d bloggers like this: