Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6160931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:24:12+00:00 2026-05-23T21:24:12+00:00

The situation is, I have a private wiki, say at http://mysite.com/wiki , which is

  • 0

The situation is, I have a private wiki, say at http://mysite.com/wiki, which is behind a password. What I’d like to do, is have a separate location on the same server, that could read arbitrary text files with wiki text (code), and use the particular engine of http://mysite.com/wiki to render HTML from it (because of installed templates/plugins).

As example, I would have a /tmppub directory on http://mysite.com; and in it, I’d have a text file with wiki text source code in it, say Example.wiki, and a process.php page; then I’d call:

http://mysite.com/tmppub/process.php?file=Example.wiki

… where process.php would read the file Example.wiki in the same directory, pass the contents somehow to the ../wiki installation, and retrieve the HTML output and display it.

I guess, what I want is similar to the example in Mediawiki2HTML – gwtwiki – How to convert Mediawiki text to HTML – Java Wikipedia API (Bliki engine) – except this Mediawiki2HTML is in Java (I’d want PHP) and possibly uses internal rendering engine (I’d want an already existing specific installation of Mediawiki).

The thing is, I can cook me up a PHP script which will read the file, handle the password of /wiki, and pass GET and POST variables – except I’m not sure how I would address the Mediawiki installation:

  • I could try to fake a call to &action=edit (e.g. Editing Wikipedia:Sandbox) and ask for a preview; but that would return the edit buttons and text fields, which I’d have to manually clean – no like
  • I could try to address the API, but as I can see in API:Parsing wikitext – MediaWiki, it will only work with pages already in the Mediawiki installation – not with pages off of it.

Finally, I’d like to obtain just the raw HTML of the content (without HTML for sidebars and such), as when using action parameter render (example).

 

Does anyone one if there is already such a PHP application available – and if not, what would be the proper way to address the Mediawiki installation, to obtain a ‘raw’ HTML rendering of the wiki text source?

Thanks in advance for any answers,
Cheers!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T21:24:12+00:00Added an answer on May 23, 2026 at 9:24 pm

    You can actually use the API even to parse custom wikitext using the parse action. (The title parameter is maybe a bit misleading, but it’s really just a pointer for the parser when using, for example, {{PAGENAME}}.) To parse existing page, the render action is used.

    If the authentication is HTTP-based and you have access to the MediaWiki installation, you can abuse the code that is used for maintenance scripts to load the important stuff and parse on top of that. (This is maybe a little dirty, though.) The following code is taken from includes/api/ApiParse.php and edited a little (of course, adjust the file path to your needs):

    require_once dirname( __FILE__ ) . '/w/maintenance/commandLine.inc';
    
    $text = "* [[foo]]\n* [[Example|bar]]\n* [http://example.com/ an outside link]";
    $titleObj = Title::newFromText( 'Example' );
    $parserOptions = new ParserOptions();
    $parserOptions->setTidy( true );
    
    $parserOutput = $wgParser->parse( $text, $titleObj, $parserOptions );
    $parsedText = $parserOutput->getText();
    

    The parsed HTML is now in the $parsedText variable. If you need to perform pre-save transform on the text (expand {{subst:}}s, tildes to signatures, etc.), take a look to the ApiParse.php file for reference.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Pseudo-situation: have a class (let's say BackgroundMagic ), and it has Start() and Stop()
I have the following situation: I have a object of type MyClass , which
I have this situation: I have a class which keeps track of an array
I have this situation object SuperHorribleLongName { trait X { private[SuperHorribleLongName] def internalGaga() :
First, a little explanation about my situation: I have a sample interface which is
I have a situation when I need to access the private members of a
Situation: I have a wrapper panel UserControl like this (namespaces and visual details removed
Here's the situation: I have a public repository for my open-source app on github.com.
Situation: I have this log4j logger: private static final Logger logger = Logger.getLogger(ThisClassName.class); And
I'am having the following situation. We have a private method where I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.