I want to write some PHP code that will allow me to make an HTTP call to a URL (from an external, unrelated program) and have it return a JSON-formatted list of my Patreon supporters (full names only).
Edit: I have gone through the setup for making an app and getting access tokens and all that. Should've clarified.
In general, I'm a beginner to PHP so the setup process for the Patreon API has been confusing. I've never installed external packages to PHP before and the formatting of the examples given in the API Documentation is confusing to me. That, and there seem to be two different versions of the API with the documentation not specifying which is used in its examples.
I first tried the recommended solution of using Composer, and that seemed to have installed the Patreon API, but I didn't know where, and it wasn't plug and play with the code provided in an example from the docs.
So then I downloaded the API manually from their github page, taking the PHP files from the src
folder and having my code refer to them with include
.
I thought I had the API working, but it looks like certain functions aren't working as intended.
Uncaught Error: Call to a member function get() on array
This was after my attempt to implement the aforementioned example. The fetch_campaign()
function seems to not exist in the API.php file, so I replaced it with fetch_campaigns()
which I saw does exist in the API.php file. Still, it seems to not have worked.
I thought this could be a quick and easy thing I could knock out in the morning before work, but as per usual it's far more difficult in practice than on paper :P
In any case, I'm simply looking for a way to return a JSON-formatted list of Patron names through PHP, and perhaps also some guidance on getting the API to work in the first place.