Php Woocommerce webhook未显示响应
我正在使用webhook来注意订单何时更新 我的webhook函数如下所示:Php Woocommerce webhook未显示响应,php,laravel,api,woocommerce,Php,Laravel,Api,Woocommerce,我正在使用webhook来注意订单何时更新 我的webhook函数如下所示: public function webhook(Request $request) { if(!empty(Request::header('x-wc-webhook-delivery-id'))) { $head = Request::header('x-wc-webhook-source'); $site = preg_replace('{/$}', '', $head)
public function webhook(Request $request) {
if(!empty(Request::header('x-wc-webhook-delivery-id'))) {
$head = Request::header('x-wc-webhook-source');
$site = preg_replace('{/$}', '', $head);
$webhookId = Request::header('x-wc-webhook-id');
$deliveryId = Request::header('x-wc-webhook-delivery-id');
$this->webhookOrders($site, $webhookId, $deliveryId);
}
}
因此,它将启动webhookOrders函数,该函数仅通过WebhookId和deliveryId获取更新的订单:
$delivery = $woocommerce->get('webhooks/'.$webhookId.'/deliveries/'.$deliveryId);
尽管奇怪的是,当我试图通过webhook访问这个get请求时,它向我显示了一个空响应:
Array
(
[id] => 559
[duration] =>
[summary] =>
[request_method] =>
[request_url] => https://<my_platform>/api/v1/orders/create
[request_headers] =>
[request_body] =>
[response_code] =>
[response_message] =>
[response_headers] =>
[response_body] =>
[date_created] => 2018-02-28T10:48:05
[_links] => Array
(
[self] => Array
(
[0] => Array
(
[href] => https://<my_woo_site>/wp-json/wc/v1/webhooks/0/deliveries/559
)
)
[collection] => Array
(
[0] => Array
(
[href] => https://<my_woo_site>/wp-json/wc/v1/webhooks/0/deliveries
)
)
[up] => Array
(
[0] => Array
(
[href] => https://<my_woo_site>/wp-json/wc/v1/webhooks/0
)
)
)
)
数组
(
[id]=>559
[持续时间]=>
[摘要]=>
[请求方法]=>
[请求url]=>https:///api/v1/orders/create
[请求\u头]=>
[请求正文]=>
[响应\u代码]=>
[回复信息]=>
[响应标题]=>
[答复(正文)]=>
[创建日期]=>2018-02-28810:48:05
[\u链接]=>数组
(
[self]=>阵列
(
[0]=>阵列
(
[href]=>https:///wp-json/wc/v1/webhooks/0/deliveries/559
)
)
[集合]=>阵列
(
[0]=>阵列
(
[href]=>https:///wp-json/wc/v1/webhooks/0/deliveries
)
)
[up]=>阵列
(
[0]=>阵列
(
[href]=>https:///wp-json/wc/v1/webhooks/0
)
)
)
)
在Woocommerce管理面板中,它向我显示了以下内容:
另外,让我抓狂的是,当我访问webhook外部的URL时,它会向我显示内容。并且日志文件没有显示任何错误
希望有人知道这个问题。谢谢 找到了问题:
交货不再记录
@不推荐使用的3.3.0 Webhooks日志现在使用日志系统