1. Go to this page and download the library: Download questpass/questpass-php-sdk 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/ */
questpass / questpass-php-sdk example snippets
use Questpass\SDK\Content;
use Questpass\SDK\InMemoryStorage;
use Questpass\SDK\CurlHttpClient;
use Questpass\SDK\PositioningSettings;
$questpass = new Content(
# Questpass API endpoint that provides latest javascript
'https://api.questpass.com/v1/publishers/services/',
# Unique Service identifier
'Paste Service UUID here',
# Implementation that will hold javascript file contents
new InMemoryStorage,
new CurlHttpClient,
PositioningSettings::factory(PositioningSettings::STRATEGY_UPPER)
);
use Questpass\SDK\ElementsContextProvider;
try {
$javascript = $questpass->javascript([
$elementsProvider = new ElementsContextProvider,
new \Questpass\SDK\SubscriptionsContextProvider,
]);
} catch (Questpass\SDK\NetworkErrorException $e) {
// Handle exception here
}
use Questpass\SDK\OAuth2Client;
use Questpass\SDK\CurlHttpClient;
$oauth2Client = new OAuth2Client(
new CurlHttpClient,
'client_id_here',
'http://questpass.com/subscriber',
'http://api.questpass.com/oauth2/token',
'http://api.questpass.com/oauth2/me',
'your_redirect_uri'
);
$authorizationUrl = $oauth2Client->authorizationUrl();
$subscriberManager = new SubscriberManager($oauth2Client, new SubscriberSessionStorage);
$subsciber = $subscriberManager->handleRedirect($_GET['code']);
$serviceApiUrl = new \Questpass\SDK\ServiceAPIUrl(
'https://api.questpass.com/v1/publishers/services/',
'Paste Service UUID here'
);
$service = new \Questpass\SDK\Service(
$serviceApiUrl,
new CurlHttpClient
);
$serviceStatusResponse = $service->fetchStatus();
$javascript = $questpass->requestJavascript();
if ($javascript) {
$content->getStorage()->set($javascript);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.