Skip to content

A read-only PHP wrapper for the GetResponse V3 API, supporting OAuth2 authorization flow

License

Notifications You must be signed in to change notification settings

GeorgeKagan/GetResponseV3Api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GetResponseV3Api

A read-only PHP wrapper for the GetResponse V3 API, supporting OAuth2 authorization flow.

Create GetResponse App

  • You need to create an app here: https://app.getresponse.com/manage_api.html (Third party applications)
  • Note the Client ID & Client Secret, you will need them.
  • Set Redirect URL to your web app's route responsible for fetching the access token, after user approves to grant your app access.

Usage

  • Install via composer: composer require timenomad/getresponse-v3-api
  • Init API object: $getResponse = new \Timenomad\GetResponseV3Api("*Client ID*", "*Client Secret*", "*State*");.
    State is just a random combination of characters, to validate callback's origin. It's a static value.
    An example would be: fdsfjhs3SDGg23refsd2u09@$
  • Get OAuth2 user consent URL: $getResponse->getOAuthConsentUrl()
  • When user approves and your callback URL is called: $accessToken = $getResponse->getAccessToken();
  • Store the token in your storage engine
  • Having the token, we can now configure the authentication and begin calling the API:
    $getResponse->setAccessToken($token['access_token']);
    $getResponse->setAccessTokenExpiryCallback($token['refresh_token'], function($newTokenData) {
    // Access Token expired. This function will be called after a new token has been generated.
    // Here you can save the new token data to the database, or any other storage means.
    });
  • We can now call the API!
    $userInfo = $getResponse->getAccountInfo();
    $campaigns = $getResponse->getCampaigns();
    $statistics = $getResponse->getCampaignStatistics();

SSL Verification

For development purposes, it can be handy to disable curl's SSL certificate verification, to do so, instantiate the API wrapper object like so (4th param sets to bypass verfification):

GetResponseV3Api(x, y, z, true)

About

A read-only PHP wrapper for the GetResponse V3 API, supporting OAuth2 authorization flow

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages