Im developing a shopify public application using Official Shopify Php API Library and Codeigniter4. I registered for Product update Webhook in shopify which send response to one of my codeigniter controller.
The problem is after processing the request I see empty header values as follows:
{"Host":{},"User-Agent":{},"Content-Length":{},"Accept":{},"Accept-Encoding":{},"Content-Type":{},"X-Forwarded-For":{},"X-Forwarded-Proto":{},"X-Shopify-Api-Version":{},"X-Shopify-Hmac-Sha256":{},"X-Shopify-Product-Id":{},"X-Shopify-Shop-Domain":{},"X-Shopify-Topic":{},"X-Shopify-Webhook-Id":{}}
the controller is:
class ProdHook Extends Controller{
public function index(){
$headers = $this->request->headers();
print_r($headers);
}
}
The $this->trequest->headers()
is returns empty header values. But when I replace this with native php function getallheaders()
, I can get all header values without any issues. The output of getallheaders()
is :
{"Host":"e703.ngrok.io","User-Agent":"Faraday v1.8.0","Content-Length":"2132","Accept":"/","Accept-Encoding":"gzip;q=1.0,deflate;q=0.6,identity;q=0.3","Content-Type":"application/json","X-Forwarded-For":"34.xx.xxx.11","X-Forwarded-Proto":"https","X-Shopify-Api-Version":"2021-10","X-Shopify-Hmac-Sha256":"xxxxxxxx","X-Shopify-Product-Id":"78803xxxxxx922","X-Shopify-Shop-Domain":"xxxxx.myshopify.com","X-Shopify-Topic":"products/update","X-Shopify-Webhook-Id":"uasdhxxxxx-b30c-fdc6e6865609"}
I don't how to fix this issue. I want to stick with native codeigniter4. Thanks in advance.