Jump to content

ERROR (Raw data option with CURL not supported for PUT) curl / WireHttp – php settings


sz-ligatur
 Share

Recommended Posts

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

@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().

  • Like 1
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...