Fullscreen
[Show/Hide Right Column]

Display contents of another web page

Plugin Snarf

This Wiki Plugin replaces itself with the body (HTML) text at the URL given in the url argument. It is similar to the Integrator

Arbitrary regex replacement can be done on this content using regex and regexres, which are used as the first and second arguments to preg_replace, respectively, after pulling out just the <body> data.

Usage

To use this plugin in a wiki page, use the syntax:
{SNARF(url=>http://www.lojban.org,regex=>;.*(.*).*;, regexres=>$1)}This data is put in a CODE caption.{SNARF}


params: url, regex, regexres

Example

{SNARF
(url=>http://www.livejournal.com/users/rlpowell/2418.html, regex=>/.*<!-- Content -->.*?<td>(.*?)<\/td>.*?<\/div>(.*?)<hr.*?<!-- \/Content -->.*/s, regexres=><p>$1</p>$2)}[http://www.livejournal.com/users/rlpowell/2418.html]
{SNARF}


To include the content of a Wikipage of another Tiki-installation you can use the following syntax:

{snarf url="http://my.foo.bar/tiki-index_raw.php?page=ExamplePage" wrap="1" ishtml="1" cache="20"}


or the longer syntax:

{SNARF(url="http://my.foo.bar/tiki-index_raw.php?page=ExamplePage" wrap="1" ishtml="1" cache="20")}{SNARF}


Do NOT type: ".../tiki-index.php?page=..." BUT ".../tiki-index_raw.php?page=..."
This kind of SNARF syntax works in Tiki 5.x and 6.0 and only with Wikipages (not with articles)


Parameters

NameValueDescriptionVersion
urlurlurl
regexPCRE compliant regular expressionpart to be changed
regexresPCRE compliant regular expressionchange
cachenumber number of minutes the url is cached - if not specified, the default site cache time will be usedtw >=5.0
ajaxstringDisplays only the string and when the user clicks on it, fetch the content of snarf with ajaxtw>=6.0

Plus all the PluginCode parameters


Related pages


Contributors to this page: Marc Laporte8178 points  , Torsten Fabricius1665 points  , lindon5653 points  , sylvie7160 points  , Xavi64690 points  and system .
Page last modified on Thursday 26 January, 2012 17:27:19 UTC by Marc Laporte8178 points .
The content on this page is licensed under the terms of the Creative Commons Attribution-ShareAlike License.

Site Language

Reference Guide

Keywords

These keywords serve as "hubs" for navigation within the Tiki documentation. They correspond to development keywords (bug reports and feature requests):



Tiki Newsletter

Delivered fresh to your email inbox!
Newsletter subscribe icon
Don't miss major announcements and other news!
Contribute to Tiki