Practical use of the API (PHP)

in utopian-io •  7 years ago  (edited)

api.jpg

Sooner or later, any programmer encounters such a concept as an API. However, when such a meeting occurs, not everyone knows what it is, why it is needed, and how to use it. And in this article I'm going to fill this gap in the knowledge of some of you, as well as give an example from my practice.

The API (application programming interface) is the application programming interface. In a simpler language, it is a set of different functions, constants, classes, query formats that can be used in other programs.

We can assume that the API is an object, the implementation of which we do not know, however, we can use it. For example, a computer is an object that very few people know about, but almost everyone can use it, doing something: watching a video, surfing the Internet, printing text, and so on. How it all works is not enough, who knows, but almost everyone can do it.

An example of the API is the Windows API, the OpenGL API, the Direct3D API, and so on.

For example, not so long ago I also encountered directly with the API. I registered on the mailing list service "Google.com" and started a mailing list, to which people began to subscribe. The task was as follows: within a day after the subscription a person can purchase a discounted video course at a discount. Since all the information about subscribers is stored on the server "Google.com", I did not have usual access (for example, through the database) to these data, but it was necessary to implement it. Fortunately, "Google.com" has its own API, which I used.

I found a request format in their API to get the subscription date as a result. Then, through cURL, I sent the appropriate request and received the desired subscription date for the specific e-mail address. Then the standard processing and output of the result.

I really hope that after this article you now perfectly understand what an API is. So that when you come across this concept in practice, you immediately solved your problem, as I did.

https://myrusakov.ru/php-api.html



Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

@yatsuk.kostia, No matter approved or not, I upvote and support you.

@steemitstats Thank you

Your contribution cannot be approved because it does not follow the Utopian Rules.

  • Post content is not directly related to the repository attached.

  • It's a broad, general topic on programming. We expect direct relation to open-source projects not the general concepts.

  • Contribution is not detailed enough. We expect more authoring in this category.

You can contact us on Discord.
[utopian-moderator]