Closed dsuguy2007 closed 1 day ago
While we cannot help debug your code, my first observation is that your code only fetches the first 25 people in your organization. If you view https://api.planningcenteronline.com/people/v2/people in your browser, you will see that there are links
that point to the next
page. You will need to fetch that next
link and keep fetching until you run out of pages.
Related Product Which product is this question related to? People
Describe the question I tried to write some code with help from chatGPT. I can't get it to work. Below is the code. Any help would be appreciated. I have checked and there should be like 5 upcoming birthdays and 2 anniversaries but this code just returns "No upcoming..."
code.php `function getUpcomingEvents($appId, $appSecret) { $apiBaseUrl = 'https://api.planningcenteronline.com/people/v2/people'; $today = new DateTime();
$nextWeek = (new DateTime())->modify('+7 days');
}
// Replace with your actual PCO App ID and Secret $API_APP_ID = 'my_app_ID'; $API_SECRET = 'my API secret';
list($birthdays, $anniversaries) = getUpcomingEvents($API_APP_ID, $API_SECRET); `
index.php `<!doctype html>
Upcoming Birthdays
Upcoming Anniversaries