Kayıtlar

Mart, 2022 tarihine ait yayınlar gösteriliyor

Create API with PHP

Resim
Creating an API in PHP One of the key components of my  GSoC Project  was to have a POST API for the Android App generator. This was required so that the app generator could be plugged into the server and can be called directly instead of someone manually visiting the webpage and entering his/her details. It takes in a JSON input and compiles and emails the app to the organizer based on his email address in the input JSON. The input to the API will look something like this : { “email”: “harshithdwivedi@gmail.com”, “app_name”: “MyApp”, “endpoint”: “ https://open-event-dev.herokuapp.com/api/v2 " } Once the data is sent, on the server I have a php file which intercepts the requests and performs an action based on the request. So basically, first we check for a valid request (GET/POST) and throw an error if it is invalid. Next up, for a valid request we store the body into a variable and then execute a followup script as per our needs using data from this response. This PHP file s...