Tags:
create new tag
view all tags

SID-01477: mirroring twiki pages - fetch content as xhtml

Status: Answered Answered TWiki version: Perl version:
Category: CategoryRendering Server OS: Last update: 13 years ago

Hi,

I want to mirror the content of a TWiki website on another one runnind Drupal.

Is it possible to fetch page content of the Twiki site as xhtml?

E.g., in the case of MindTouch dekiwiki, one can get access to the content of the pages through its API. The content then can be fetched with e.g.

http://dekiwiki.example.com/@api/deki/page/32/contents?format=xhtml

and displayed in a Drupal node using an embedded php script.

Can something similar be done with Twiki?

Thanks, Rossen

-- RossenApostolov - 2012-06-11

Discussion and Answer

You can apply a different skin. Here are some choices, applied to this support page:

You can also create your own skin. Details in TWikiSkins

-- PeterThoeny - 2012-06-11

Thanks Peter!

I can get the different rendering but on the Drupal side I get

"Forbidden You don't have permission to access /twiki/bin/view/Xmipp/Tutorials on this server." when fetching the content with curl (from within php).

It's not a twiki issue, but do you have an idea why I get this erro?

Rossen

-- RossenApostolov - 2012-06-11

P.S. I'm able to fetch the content with curl from the commandline though.

-- RossenApostolov - 2012-06-11

This is either an Apache configure issue on the TWiki server, or an access control issue in TWiki. In the former case check the Apache settings for TWiki is curl is on the deny list. In the latter case, either remove the access restriction, or login properly with curl.

-- PeterThoeny - 2012-06-11

P.S.S.

$ curl -i http://xmipp.cnb.csic.es/twiki/bin/view/Xmipp/Tutorials?skin=text HTTP/1.1 200 OK Date: Mon, 11 Jun 2012 19:50:47 GMT Server: Apache/2.2.16 (Debian) Set-Cookie: TWIKISID=81a23d7c9ffa26798b181c90b3fdd5ca; path=/ Content-Length: 760 Vary: Accept-Encoding Content-Type: text/html; charset=iso-8859-1

<h3><a name="Tutorials"></a> Tutorials </h3> ...

while the script below returns 403 error:

<?php $ch = curl_init(); $timeout = 5; // set to zero for no timeout curl_setopt ($ch, CURLOPT_URL, 'http://xmipp.cnb.csic.es/twiki/bin/view/Xmipp/Tutorials?skin=text'); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $file_contents = curl_exec($ch); curl_close($ch); // display file echo $file_contents; ?>

-- RossenApostolov - 2012-06-11

Hi Peter,

I saw your comment after I posted the last reply. Thanks for the help, I'll check as suggested.

Rossen

-- RossenApostolov - 2012-06-11

SOLVED:

Just a note if someone faces the same problem in future. You need to add

curl_setopt($ch, CURLOPT_USERAGENT, "RBot/0.1 (+http://www.xyz.com)");

For some reason, php curl doesn't set the user agent parameter and curl itself does, so Apache is preventing the non-identified access.

-- RossenApostolov - 2012-06-26

      Change status to:
ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
SupportForm
Status Answered
Title mirroring twiki pages - fetch content as xhtml
SupportCategory CategoryRendering
TWiki version

Server OS

Web server

Perl version

Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r6 - 2012-06-26 - RossenApostolov
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.