Fetching JSON Data from http urls fails with src
Hi,
when using the "src" attribute with the json-data dokuwiki plugin it fails to fetch data from external services.
Example
<json src="https://dummyjson.com/products/1"></json>
the error log tells us:
E_WARNING: file_get_contents(https://dummyjson.com/products/1): failed to open stream: HTTP request failed! HTTP/1.1 426 Upgrade Required
The page says in the ERROR Tab: EMPTY File
This is actually also the case on the json_data demo website https://dokuwiki-json-demo.1001beauty.si/doku.php?id=json:json_definition_demo under the "External JSON file from internet" headline.
in php.ini fetching from external urls is allowed. (allow_url_fopen = On)
I tried to add some more parameters in helper.php for the file_get_contents() call but it doesn't work.
E.g. adding the protocol_version = 2.0 because of the upgrade error.
Do you have any ideas?
Dokuwiki version is: 2023-04-04a "Jack Jackrum" on Debian Bookworm with following PHP packages:
ii php-bcmath 2:7.4+76 all Bcmath module for PHP [default] ii php-common 2:76 all Common files for PHP packages ii php-curl 2:7.4+76 all CURL module for PHP [default] ii php-fpm 2:7.4+76 all server-side, HTML-embedded scripting language (FPM-CGI binary) (default) ii php-gd 2:7.4+76 all GD module for PHP [default] ii php-ldap 2:7.4+76 all LDAP module for PHP [default] ii php7.4-bcmath 7.4.33-1+deb11u4 amd64 Bcmath module for PHP ii php7.4-cli 7.4.33-1+deb11u4 amd64 command-line interpreter for the PHP scripting language ii php7.4-common 7.4.33-1+deb11u4 amd64 documentation, examples and common module for PHP ii php7.4-curl 7.4.33-1+deb11u4 amd64 CURL module for PHP ii php7.4-fpm 7.4.33-1+deb11u4 amd64 server-side, HTML-embedded scripting language (FPM-CGI binary) ii php7.4-gd 7.4.33-1+deb11u4 amd64 GD module for PHP ii php7.4-json 7.4.33-1+deb11u4 amd64 JSON module for PHP ii php7.4-ldap 7.4.33-1+deb11u4 amd64 LDAP module for PHP ii php7.4-opcache 7.4.33-1+deb11u4 amd64 Zend OpCache module for PHP ii php7.4-readline 7.4.33-1+deb11u4 amd64 readline module for PHP ii php7.4-xml 7.4.33-1+deb11u4 amd64 DOM, SimpleXML, XML, and XSL module for PHP