Event Webhook:获取 URL 中的参数

问题描述 投票:0回答:1

我有一个没有mod重写的Yii应用程序,控制器需要在URL中设置:

?r=controller/action
在应用程序中:我想为 Event Wehook

创建一个系统

我将此链接 https://example.com/?r=sendgrid/action 添加到 app.sendgrid.com/settings/parse :该操作永远不会发生:链接永远不会调用(我只是将其记录在文件上以进行检查:直接通话就像魅力)。

我用另一种方式测试我创建一个checksendgrid.php文件

    <?php
    $postedValues = $_POST;
    $gettedValues = $_GET;
    $values = [
        'post' => $postedValues,
        'get' => $gettedValues,
    ];
    $result = file_put_contents(
        '/var/log/test/sendgrid.log',
        json_encode($values),
        FILE_APPEND | LOCK_EX
    );
    file_put_contents(
        '/var/log/test/sendgrid.log',
        "\n",
        FILE_APPEND | LOCK_EX
    );
    $data = file_get_contents("php:/input");
    $events = json_decode($data, true);
    if(!empty($events)) {
        foreach ($events as $event) {
            $result = file_put_contents(
                '/var/log/test/sendgrid.log',
                json_encode($event),
                FILE_APPEND | LOCK_EX
            );
            file_put_contents(
                '/var/log/test/sendgrid.log',
                "\n",
                FILE_APPEND | LOCK_EX
            );
        }
    }
    file_put_contents(
        '/var/log/test/sendgrid.log',
        "\n",
        FILE_APPEND | LOCK_EX
    );

在解析设置上设置此文件

example.org/checksendgrid?param=ok
并仅在日志上获取:

{"post":[],"get":[]}
{"bounce_classification":"Unclassified","category":["survey:441148"],"email":"[email protected]","event":"bounce","ls-survey":"441148","ls-tid":"3","ls-token":"ezrzer","reason":"unable to get mx info: failed to get IPs from PTR record: lookup <nil>: unrecognized address","sg_event_id":"Ym91bmNlLTQtMzUyODUzODAtOFI1eTZKb3JSZjZTV01oaUI1Zlg1US0w","sg_message_id":"8R5y6JorRf6SWMhiB5fX5Q.filterdrecv-d7bbbc8bf-pldp9-1-64BA8FFE-40.0","smtp-id":"<kQboWY6eRJIzjnFpAw9q6xi1Ly4y2AwskpgEYQkK9Ek@oecd-dev.sondages.pro>","timestamp":1689948459,"tls":0,"type":"blocked"}

有没有办法在 Inboud 解析中使用 GET 参数?

php sendgrid inbound
1个回答
0
投票

我终于转向入站解析:https://docs.sendgrid.com/for-developers/parsing-email/setting-up-the-inbound-parse-webhook 在这里,它起作用了。

谢谢

© www.soinside.com 2019 - 2024. All rights reserved.