Skip to content

Instantly share code, notes, and snippets.

@eriktorsner
Created July 2, 2020 13:58
Show Gist options
  • Save eriktorsner/f7a98a701868677353ae158ce70516c1 to your computer and use it in GitHub Desktop.
Save eriktorsner/f7a98a701868677353ae158ce70516c1 to your computer and use it in GitHub Desktop.
<?php
$secret = 'top_secret';
$url = 'https://example.com/wa-hook/abc123abc123
$parameters = ['foo' => 'bar'];
$args = ['headers' => []];
$args['body'] = json_encode($parameters);
$hash = hash_hmac('sha1', $args['body'], $secret);
$args['headers']['Content-Type'] = 'application/json; charset=utf-8';
$args['headers']['X_HUB_SIGNATURE'] = $hash;
$request = wp_remote_post($url, $args);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment