I am currently creating a .NET Core WebAPI secured with Azure AD. (Which is also giving me challenges see here
I want to call this API from a Wordpress website but need to do a headless service-to-service call. So I need to get an access_token from azure ad (using my active directory app) and send this as the Bearer token.
I've had a look around for PHP samples but nothing concrete has come up so far, so would be great to get some pointers or samples on this.
According to your description, you can custom PHP script in your WP application to acquire access token via client credentials
flow.
For the detailed steps, you can refer to Call Microsoft Graph in a service or daemon app and https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-protocols-oauth-code for basic concepts.
And you can refer to https://github.com/Azure-Samples/active-directory-php-graphapi-web/blob/master/PHP/AuthorizationHelperForGraph.php for the PHP sample functionality in the similar scenario.