sz-ligatur Posted February 16, 2022 Share Posted February 16, 2022 In connection with SnipWire I had problems today with API calls that should be executed as put. The function [Update order] caused an error: "Raw data option with CURL not supported for PUT". cURL is enabled on the server in version 7.64.0, PHP 7.4 After finding the explanation below, I enabled allow_url_fopen in the php settings - so the error disappeared, everything seems to work now. Quote The WireHttp core class now includes cURL support. In practice this means that when you make a HTTP request using WireHttp, behind the scenes it'll attempt to use PHP's fopen(), and if that isn't available it will fall back to sockets – and finally, if sockets are unavailable as well, it will attempt to use cURL. https://github.com/processwire/processwire/blob/dev/wire/core/WireHttp.php#L670 I am now confused because I read this as cURL not working correctly – as it is used as a fallback in WireHttp. Is that so? Could someone with more insight enlighten me here? Should I be happy that it's working with fopen() and forget about the cURL error? Thanks! Link to comment Share on other sites More sharing options...
ryan Posted February 16, 2022 Share Posted February 16, 2022 @sz-ligatur It depends on the PW version. fopen used to be the default, but it's more and more common for allow_url_fopen to be disabled, so I've switched the default to CURL (when available) on the dev branch. In any case, with CURL, the flag that you set raw data with also makes it use POST, so I'm not sure how you send raw data (other than a file resource) with CURL using PUT, so you probably should make use use fopen for that case. You can force it to use fopen by specifying ['use' => 'fopen'] for the $options argument to WireHttp::send(). 1 Link to comment Share on other sites More sharing options...
sz-ligatur Posted February 17, 2022 Author Share Posted February 17, 2022 Hello Ryan, thank you for your instant reply. I'm sorry to admit that I don't fully understand the context - but I'll reach out to @Gadgetto to see how far this might mean a bug fix for snipWire. Its a function in SnipWire orders admin where I've got this error. Link to comment Share on other sites More sharing options...
Recommended Posts