Extension:Webservice
Webservice Release status: stable |
|||
---|---|---|---|
Implementation | Tag, Parser function | ||
Description | Pull data from an external webservice into a wiki page | ||
Author(s) | Chris Reigrut, Key Bank / Key Equipment Finance | ||
Last version | 0.3.0 (03/20/2009) | ||
MediaWiki | 1.11 - 1.13 | ||
License | No license specified | ||
Download | Extension:Webservice#Installation | ||
|
|||
Check usage (experimental) |
This extension allows you to easily include information from an external webservice into a wiki page. For instance, you could pull data from a web page, an XML feed, etc.
It currently requires an internal version of tidy and PHP5. I'll likely add external Tidy and pre-PHP5 support at some point.
Contents |
[edit] Usage
This is a function extension primarily, and takes three parameters (in order):
- URL
- The full url of the webservice that you wish to use
- Wikitext
- The wikitext to insert into the page--additionally, anything between % signs will be replaced with the result of executing that text as an XPath string on the document returned from the URL.
- Options
- Currently, there are three possible options:
- IE - Impersonate Internet Explorer (by changing the user-agent)
- TIDY-XHTML - Run tidy on the document returned from the URL, converting it to XHTML
- COOKIE:key=value - Insert a cookie specified by the key and value into the request headers
- ENCODING:value - The encoding of the web service information (needed by Tidy: see The Tidy documentation for valid values). Defaults to utf8.
[edit] Example
{{#webservice:http://www.w3c.org|The title of the webpage at http://www.w3c.org is %//html/head/title%}}
[edit] Installation
- Create a directory called Webservice in your extensions directory
- Download webservice.php into your Webservice directory
[edit] Parameters
If you are behind a proxy (i.e. you have set $wgHTTPProxy
in LocalSettings.php
), you can set an additional variable $wgHTTPProxyExceptions
which is an array of URL patterns to exclude from the proxy. For example:
$wgHTTPProxyExceptions = array( '/^(http:\/\/|https:\/\/)?([^\.]*\.)?key\.com(\/|\?|&|$)/i', '/^(http:\/\/|https:\/\/)?([^\.]*\.)?keybank\.com(\/|\?|&|$)/i', '/^(http:\/\/|https:\/\/)?([^\.]*\.)?mdd\.com(\/|\?|&|$)/i', );
would exclude any URLs that end in key.com, keybank.com or mdd.com.
[edit] Changes to LocalSettings.php
require_once("$IP/extensions/Webservice/webservice.php");
[edit] Revision History
- 0.3.0 (03/20/2009)
- Minor fixes to error handling
[edit] Sites using this extension
Please add your site (and a link if it is public) to the list! Thanks!
- Key National Finance WiKey (internal intranet)