First, turn on the Client Credentials grant on then Advanced settings > Grant Types tab on the Application settings page. Next, authorize the Application for the API being used on the Machine to Machine Applications tab on the API’s Settings page. Make sure all necessary scopes are selected (but no more) and Update.
Read moreHow do I authenticate in PHP?
HTTP authentication with PHP ¶ It is possible to use the header() function to send an “Authentication Required” message to the client browser causing it to pop up a Username/Password input window .
Read more