'application/json', 'User-Agent' => 'Bookingistic/' . BOOKINGISTIC_VERSION, 'X-Bookingistic-Event' => $body['event'] ?? '', ], $extra_headers ); if ( $secret ) { $headers['X-Bookingistic-Signature'] = 'sha256=' . hash_hmac( 'sha256', $payload, $secret ); } $res = wp_remote_post( $url, [ 'timeout' => 8, 'headers' => $headers, 'body' => $payload, ] ); if ( is_wp_error( $res ) ) { return [ 'ok' => false, 'error' => $res->get_error_message(), 'code' => 0 ]; } $code = (int) wp_remote_retrieve_response_code( $res ); return [ 'ok' => $code >= 200 && $code < 300, 'code' => $code, 'body' => wp_remote_retrieve_body( $res ), ]; } }