Hello All: I am hoping someone can help me with this. I have never done a call to an API and am really out of my depth. What I am trying to do is a call to an API on a wordpress page. Here is what I have from the API:
http://zipcodedistanceapi.redline13.com/rest//distance.///
I have an API key. I have been trying to learn how to do this but there are thousands of ways and am really at a loss how to do this on a wordpress page. Can anyone help?
Thanks so much, Gerard
You can do it in php (here I use file_get_contents):
Example taken from their site:
You can also use cURL or anything which can call an external page.
To decode json, have a look on json_decode.
Think about caching the values using your database or user cookies if possible to avoid multiple unnecessary requests.
EDIT: Based on the code provided in your comment (I took a fake API key from demonstration purposes):