简体   繁体   中英

get request URL in webhook woocommerce

I want to get te request_url from the shop who use my webhook, actually I have this code:

$webhookContent=        "";
$webhook=               fopen('php://input' , 'rb');
while (!feof($webhook)) {
    $webhookContent .=  fread($webhook, 4096);
}
fclose($webhook);
$data=      json_decode($webhookContent,true);

$shop = $json['Shop'];

But, since wordpress update their versions, I can`t get The URL where the webhook was delivered, is very important to get it, because I provide a logistic service based in this URL.

In the webhook content only have the details of the order (I use woocommerce)

Update:

I can solved my problem usign only this: $_SERVER['HTTP_X_WC_WEBHOOK_SOURCE'] .

你必须以raw格式获取数据,我用它做了:$ postdata = json_decode(file_get_contents(“php:// input”));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM