how to post JSON obj with attribute, to an API url using PHP? -
really stumped @ how approach - need to:
take json data attribute, php post api/url. should have json file in folder, file call url , pass json? how can return calculation results via json? learn this, have array of numbers, perform calculations return mean, median, mode, , range. working files need available api.
sample json data post: { "numbers": [ 5, 6, 8, 7, 5 ] }
sample json return response single endpoint called "/mmmr" [abbrev calculations]:
{ "results": { "mean": 6.2, "median": 6, "mode": 5, "range": 3 } }
been searching, trying things hours, not clicking @ all. have class calculate call , returns results calculations already, how "make available via api"? please sample working code, perhaps can understand seeing it.
Comments
Post a Comment