Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How to check BeMob landing signature with PHP
define('LANDING_SECRET_KEY', 'ODk4ZDc2MjM2MGE4NmRjMmRiY2E3Njg1MDFlZTU0MTIxNjU5YzE1Yw=='); // Your landing secret key from -> Settings -> Tracker
define('SIGNATURE_TTL', '1 minute'); // How long signature should be valid. Valid formats are explained here:
define('SIGNATURE_GET_PARAM', 'key'); // GET parameter with BeMob landing signature
$signature = isset($_GET[SIGNATURE_GET_PARAM]) ? rawurldecode($_GET[SIGNATURE_GET_PARAM]) : exit('Access denied');
if (!$signature = base64_decode($signature)) {
exit('Access denied');
if (!$signature = json_decode($signature, true)) {
exit('Access denied');
if (!isset($signature['timestamp']) || !isset($signature['hash'])) {
exit('Access denied');
$signedHash = hash_hmac('sha1', $signature['timestamp'], LANDING_SECRET_KEY);
if ($signedHash !== $signature['hash'] || strtotime(SIGNATURE_TTL, $signature['timestamp']) < time()) {
exit('Access denied');
?><!DOCTYPE html>
<title>BeMob Landing Signature Example</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="">
<link rel="stylesheet" href="">
<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="#">BeMob Landing Signature Example</a>
<div class="container theme-showcase" role="main">
<div class="jumbotron">
<h1>BeMob Landing Signature Example</h1>
<a href="" id="ctaUrl" class="btn btn-success">Click me!</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment