Dump uniform webhook data

Hi Forum,

I have a simple form which updates an email address via a webhook action to an external api using the uniform plugin. The webhook seems to works fine but I like to see the entire request / json data being send. Is there a way I can dump the json data in php? This might be a simple question but I’m struggling to get this working.

controller.php

<?php
use Uniform\Form;

return function ($kirby, $page)
{
    $form = new Form([
        'email' => [
            'rules' => ['required', 'email'],
            'message' => 'Please enter a valid email address',
        ],
    ]);

    if ($kirby->request()->is('POST')) {
        $form->webhookAction([
            'url' => 'https://super-secret.url/api',
            'json' => true,
            'params' => [
                'method' => 'PUT',
                'only'  => ['email'],
                'headers' => ['Authorization: Basic qwertzqwertz'],
            ],
        ]);
    }

    return compact('form');
};

Thanks in advance!

Wasn’t there a log function in Uniform? There’s a closing quote missing after the URL in your code snippet above…

There’s a build in log action but it does not include the json code being send.

@mzur Hi :slight_smile: Is there a way to accomplish the above step I try to achieve? And also a way to fetch the result/http status code?

I don’t know about Uniform, but $_POST contains the post data (or $kirby->request()->data()), so you can log this.

1 Like

Thanks that worked :slight_smile: