PHP code example of kristenlk / oauth2-marketo

1. Go to this page and download the library: Download kristenlk/oauth2-marketo library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kristenlk / oauth2-marketo example snippets



$provider = new \Kristenlk\OAuth2\Client\Provider\Marketo([
    'clientId'          => '{marketo-client-id}',
    'clientSecret'      => '{marketo-client-secret}',
    'baseUrl'           => 'https://your-base-url.mktorest.com'
]);

// Try to get an access token (using the client credentials grant)
$token = $provider->getAccessToken('client_credentials');

// Use this to interact with an API on the users behalf
echo $token->getToken();