Eventbrite API: oauth2-login-example.php
-
03-07-2021 - |
Question
I can't get the oauth2 working using the PHP library. I can get the jQuery library to work but I'd rather use PHP.
I get this error:
Warning: Cannot modify header information - headers already sent by (output started at /home/dotd/public_html/hub/examples/oauth2-login-example.php:22) in /home/dotd/public_html/hub/Eventbrite.php on line 162
You can see it here: http://www.daysofthedead.net/hub/examples/oauth2-login-example.php
It's the same code from github except I changed the app_key
and client_secret
.
( https://github.com/ryanjarvinen/eventbrite.php )
I have the "OAuth Redirect URI" pointing to http://www.daysofthedead.net/hub/examples/oauth2-login-example.php
La solution
The issue was that the code was attempting to trigger a header redirect (HTTP302) AFTER php had already written a portion of the response as an HTML page (HTTP200).
I've relocated portions of the demo code so that the redirect (if needed) will be called BEFORE any of the page output is written.
Please try replacing your OAuth2-login-example file. Hope that works!