I have created some reports for some web pages that use JavaScript HTTP Requests to retrieve some data from an API. I would like to use the reports on some WordPress pages. I have done a lot of searching and reading. I am a complete beginner at customizing a WordPress page. While I don't mind experimenting, I would rather get some guidance for how to proceed.
The options appear to be:
Use a plugin to allow JavaScript on a WordPress page.
Use PHP to call the API, and then use PHP to create the HTML to display the data returned returned from the API.
I think the second one would be better because learning to use PHP on a WordPress page would allow for more options in the future.
I have worked in software development. I have done some programming on my own in JavaScript and Python3. I am currently going through some courses at Lynda.com to learn PHP. I am confident that I can pick it up or find what I need online to create the code I need.
I have found this plug-in: https://wordpress.org/plugins/php-everywhere/ It appears to allow me to use PHP on a WordPress page.
I also found this: WordPress has the HTTP API. https://codex.wordpress.org/HTTP_API
There are linked pages that explain how to make a request and get a response code and data: https://codex.wordpress.org/Function_Reference/wp_remote_retrieve_response_code https://codex.wordpress.org/Function_Reference/wp_remote_get
I have no problem understanding this because I did the web pages using JavaScript to get API data.
I just don't understand how to start using it. Is this a plugin? I don't think so. I think it is built-in code that I can just use.
So, can I just use the GET and Response Code functions in this reference in my PHP code once I have installed that first plug-in? (Did I mention that I am a complete beginner with customizing a WordPress page?)
I have found a number of websites explaining how to install a plug-in. I have found some websites explaining how to use the WP HTTP API. But, I need an even more basic explanation as to how to start with the WP HTTP API, and how to combine all of this. I haven't found that anywhere.
My next steps appear to be:
Install that plug-in (php-everywhere). Write some simple PHP code to create some HTML to test it on a test page.
Write a simple API call using the GET and Response Code functions from the Codex pages. Once I get some data successfully returned, I can then write more PHP code to incorporate the returned data. (I can use the web pages written in JavaScript as a guide to write the PHP to display the data.)