===== WebGet action ===== It may be necessary to fetch dynamically geneerated data from other web pages and show these into a section of a Wikka-page. The presented solution is to have a very simple syntax to fetch external data from a given URL. The code was developed against Wikka 1.1.6.2 so there are no guarantees that this will work in any other versions. This action is maintained by [[RubenOlsen Ruben Olsen]] === How to use it === After you have installed this code, you can then use the action ""{{webget URL="http://where/to/fetch/data"}}"" - and that is about everything you need to know about this action **Example**: Let's say you have a set of data files in directory. You could of course manually enter these files in the Wikka-page and every time the content of the directory changed, you had to update the page again. Instead you create a small PHP function which list the content of the directory, sorted in the correct order and returned each filename found with a simple BR-tag at the end. No fancy HTML or nothing. Really a self maintained solution. Let's say the URL for this PHP script was http://internalserver/listfiles.php - to embed the file list into a Wikka-page, just enter ""{{wegbet URL="http://internalserver/listfiles.php"}}"" where appropriate. === Beware of the following security issue === The **webget** action fetches data without discrimination of the content. If there are Java Scripts that may pose a security threat, the **webget** action //will carry// this security threat into your Wikka-page! Fetch only data you have full control over, or are deemed to be 100% safe. === Limitations === The **webget** action is not a web spider, it will only fetch a single URL. Currently there are no sane error checks either like if data can not be sucsessfully fetched. === How to install it === We are going to add one program file to the Wikka //actions// folder. First you need to locate the directory where your Wikka is installed. Then locate the //actions// folder - if you have used Wikka-actions, you will notice a lot of file names corresponding to the name of Wikka-actions. Save the follwing code (use the grab button) as //webget.php// in the //actions// folder. %%(php;1) %% **You are now ready** If something does not work yet, leave me a comment. --RubenOlsen === How it works === Using the PHP fopen() function, data is retrieved from the URL source and printed out. The fopen() function is a clever little fellow knowing a thing or two about fetching data from a URL (which can be http, ftp, file, etc). === History === 2007-Jul-25 First version ---- This page is in the category CategoryUserContributions.