Lately we encountered this issue of 411 Length required issue while trying to do POST / PUT request in shopify.
We are using this phpish Shopify private app skeleton https://github.com/phpish/shopify_private_app-skeleton
In this app skeleton we made changes in vendor/phpish/shopify/shopify.php inside client function
if (!$private_app) $request_headers['X-Shopify-Access-Token'] = $oauth_token; $request_headers['content-type'] = 'application/json; charset=utf-8'; $data_query = http_build_query($response_headers); $data_len = strlen($data_query); $request_headers['Content-Length'] =$data_len; $http_client = http\client($base_uri, $request_headers);
In above code we have added data length supplied as content length and that would solve this 411 length required error.
Cheers !!
Leave a Reply