views:

55

answers:

3

I'm done some Googling, and I've found nothing.

I'm scoping out writing a plugin for an editor I use, and I am wondering whether there is a way I can access the PHP documentation via an API? For instance, I'd like to get raw access to the information (besides the comments) located here: http://php.net/file_exists.

php.net seemingly uses MediaWiki which provides an API. The tutorial provides the example URL, http://en.wikipedia.org/w/api.php?action=login&format=xml. This does not work for php.net, however (http://php.net/w/api.php?action=login&format=xml).

I'm just looking for a little information on how to interface with the PHP documentation.

A: 

Not an API, but if this is for an editor like vim, try pman

It allows you to look at any PHP manual pages in a Unix Manual Style. If your editor allows creating shortcuts to shell commands or macros or anything like this, you just pman <function> and get a nicely formatted doc page. No need to do an HTTP request to php.net or any mirrors. And since it installs via PEAR, you can update it any time you want.

See these links:

Gordon
A: 

from http://it.php.net/docs.php

You can learn how to integrate our online manual with various tools, including your web browser, on our quick reference tips page.

You can also get more information about php.net URL shortcuts by visiting our URL howto page.

http://it.php.net/urlhowto.php

Eineki
Hmm, not exactly what I'm looking for. Looks like I may have to try some real-time data mining.
Chad Johnson
+3  A: 

The PHP documentation is not based on MediaWiki at all : the raw documentation is written in DocBook -- which is an XML-based format.

This means you should be able to use the XML source of the documentation, and parse it, using XML tools, to generate any format you need.


The source of the documentation is available on the SVN of the project : svn.php.net

And, more precisely : http://svn.php.net/viewvc/phpdoc/
(There are directories for each language, ...)

As an example, for the documentation of file_exists, you'll have to search in the filesystem/functions directory : http://svn.php.net/viewvc/phpdoc/en/trunk/reference/filesystem/

There, you'll have access to the docbook source of each page of the manual for filesystme-related functions ; for example : http://svn.php.net/viewvc/phpdoc/en/trunk/reference/filesystem/functions/file-exists.xml?view=markup

Pascal MARTIN
Great, this is probably about as good as I can ask for. I'll see if I can make this work. Thanks!
Chad Johnson
You're welcome :-) Have fun !
Pascal MARTIN