Skip to content

A PHP forward proxy for remote access to SPARQL endpoints; forwards request/response headers and filters out non-SPARQL URL arguments

License

Notifications You must be signed in to change notification settings

AKSW/SparqlProxyPHP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

#SparqlProxyPHP

A PHP forward proxy for remote access to SPARQL endpoints; forwards request/response headers and filters out non-SPARQL URL arguments.

Introduction

The proxy introduces an additional "service-uri" query string parameter which supports specifying a remote endpoint. The main motivation is to enable remote access to SPARQL endpoints from within JavaScript. Note that this proxy consists of a single file that only does the forwarding of requests and response (headers). If you are looking for a proxy that features more than that, you may want to check out this project.

Warning

Right now it is still possible to access arbitrary sites with it. There has to be added some checks whether the target is actually a SPARQL endpoint (otherwise illegal content could be obtained via the proxy). The probably simplest filtering would be the requirement, that the service-uri has to end in /sparql.

Filtering

The service-uri parameter is processed as follows:

  • Only host name, port and path are retained, all other URI components are discarded.

From the request url, the following processing is performed:

  • Only the query string arguments query, format, timeout are retained. **TODO Support at least all arguments by SPARQL spec **

Deployment (Ubuntu):

You need apache, php and php-curl installed:

sudo apt-get install libapache2-mod-php5 php5-curl

Make the script accessible via apache, e.g.

cp sparql-proxy.php /var/www

Example Usage:

The following example requests the first 3 results from LinkedGeoData.

curl http://localhost/sparql-proxy.php?service-uri=http%3A%2F%2Flinkedgeodata.org%2Fsparql&query=Select+%2A+%7B+%3Fs+%3Fp+%3Fo+%7D+Limit+3

About

A PHP forward proxy for remote access to SPARQL endpoints; forwards request/response headers and filters out non-SPARQL URL arguments

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages