PHP code example of simplicate / rainforest-auth

1. Go to this page and download the library: Download simplicate/rainforest-auth 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/ */

    

simplicate / rainforest-auth example snippets


$apiKey = 'abc';

// Should be safe data from the $_POST var
$post = [
  'digest'        => 'abc',
  'callback_type' => 'before_run',
  'options'       => [
    'run_id' => 123123,
  ],
];

$auther = new \Simplicate\Rainforest\Auther($apiKey);

if(!$auther->verify($digest, $callbackType, $options)) {
  throw new \Exception('Could not verify that the request came from Rainforest');
}

// Everything's all right! Do your housekeeping.

// Same payload as before

$callbackUrl = $auther->getCallbackUrl($post['options']['run_id'], $post['callback_type']);

// Make a POST request to this URL through php-curl, or your preferred HTTP client