WooCommerce REST API网络挂钩,如何捕获挂钩响应?

时间:2020-03-30 08:10:21

标签: wordpress woocommerce woocommerce-rest-api

我正在使用REST API创建钩子,并提供'delivery_url`,它工作正常,并按预期方式创建了webhooks。但是,每当我更新订单时,它都不会将任何内容发送到delivery_url,或者也许我不知道如何捕获来自woocommerce的响应。我用来捕获响应的代码是

$homepage = @file_get_contents("php://input");

尽管在Woocommerce>状态>日志中,我正在获取订单更新的日志

    2020-03-30T07:40:58+00:00 INFO Array
(
    [Webhook Delivery] => Array
        (
            [Delivery ID] => 76911035b958d761689abc0817188031
            [Date] => Mar 30, 2020 @ 7:40
            [URL] => https://www.dev.site.net/ccwoocommerce/webhooks.php
            [Duration] => 0.45591
            [Request] => Array
                (
                    [Method] => POST
                    [Headers] => Array
                        (
                            [User-Agent] => WooCommerce/4.0.1 Hookshot (WordPress/5.3.2)
                            [Content-Type] => application/json
                            [X-WC-Webhook-Source] => https://website.com/
                            [X-WC-Webhook-Topic] => order.updated
                            [X-WC-Webhook-Resource] => order
                            [X-WC-Webhook-Event] => updated
                            [X-WC-Webhook-Signature] => MVXYSG7cR5*****
                            [X-WC-Webhook-ID] => 223
                            [X-WC-Webhook-Delivery-ID] => *******
                        )

                )

            [Body] => Webhook body is not logged unless WP_DEBUG mode is turned on. This is to avoid the storing of personal data in the logs.
            [Response] => Array
                (
                    [Code] => 302
                    [Message] => Found
                    [Headers] => Requests_Utility_CaseInsensitiveDictionary Object
                        (
                            [data:protected] => Array
                                (
                                    [date] => Mon, 30 Mar 2020 07:40:58 GMT
                                    [server] => Apache
                                    [location] => /user
                                    [cache-control] => max-age=300
                                    [expires] => Mon, 30 Mar 2020 07:45:58 GMT
                                    [x-endurance-cache-level] => 0
                                    [content-type] => text/html; charset=UTF-8
                                )

                        )

                    [Body] => Webhook body is not logged unless WP_DEBUG mode is turned on. This is to avoid the storing of personal data in the logs.
                )

        )

)

0 个答案:

没有答案