Created
July 2, 2020 13:58
-
-
Save eriktorsner/f7a98a701868677353ae158ce70516c1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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