Module:SPARQL: Difference between revisions
From TITAF TANGOWIKI
(Created page with "local p = {} local http = require('mw.http') local json = require('mw.text').jsonDecode function p.runQuery(query) local endpoint = "https://dbpedia.org/sparql" -- Change if using a different SPARQL service local url = endpoint .. "?query=" .. mw.uri.encode(query) local response = http.request{ method = "GET", url = url, headers = { ["Accept"] = "application/json" } } if response.status ~= 200 then return "SPARQ...") |
No edit summary |
||
| Line 1: | Line 1: | ||
local | local http = require("socket.http") | ||
local | local function fetch_url(url) | ||
local body, code, headers = http.request(url) | |||
return body | |||
function | |||
local | |||
end | end | ||
return | return fetch_url("https://www.example.com") | ||
Revision as of 22:35, 21 March 2025
Documentation for this module may be created at Module:SPARQL/doc