Page Menu
Home
GitPull.it
Search
Configure Global Search
Log In
Files
F15159719
README.md
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
README.md
View Options
#
Boz
-
MW
This
is
another
MediaWiki
API
handler
in
PHP
.
##
Tools
See
[
the
tools
](./
tools
/
README
.
md
).
##
API
showcase
Here
some
usage
examples
:
```
php
<?
php
// autoload classes
require
'
boz
-
mw
/
autoload
.
php
'
;
// enable verbose messages
\
cli
\
Log
::$
DEBUG
=
true
;
echo
"Simple Italian Wikipedia API query:\n"
;
$
WIT
=
\
wm
\
WikipediaIt
::
getInstance
();
$
response
=
$
WIT
->
fetch
(
[
'
action
'
=>
'
query
'
,
'
prop
'
=>
'
info
'
,
'
titles
'
=>
[
'
Pagina
principale
'
]
]
);
print_r
(
$
response
);
echo
"Simple Italian Wikipedia API query with continuation support:\n"
;
$
members
=
\
wm
\
WikipediaIt
::
getInstance
()->
createQuery
(
[
'
action
'
=>
'
query
'
,
'
list
'
=>
'
categorymembers
'
,
'
cmtitle
'
=>
'
Categoria
:
Software
con
licenza
GNU
GPL
'
,
]
);
foreach
(
$
members
->
getGenerator
()
as
$
response
)
{
print_r
(
$
response
);
}
echo
"Simple POST request (every POST do an implicit login):\n"
;
\
mw
\
API
::$
DEFAULT_USERNAME
=
'
My
username
'
;
\
mw
\
API
::$
DEFAULT_PASSWORD
=
'
My
bot
password
'
;
$
wit
=
\
wm
\
WikipediaIt
::
getInstance
();
$
response
=
$
WIT
->
post
(
[
'
action
'
=>
'
edit
'
,
'
title
'
=>
'
Special
:
Nothing
'
,
'
text
'
=>
'
My
wikitext
'
,
'
summary
'
=>
'
My
edit
summary
'
,
'
token
'
=>
$
wit
->
getToken
(
'
csrf
'
),
]
);
print_r
(
$
response
);
```
##
Known
usage
*
[
ItalianWikipediaDeletionBot
](
https
:
//github.com/valerio-bozzolan/ItalianWikipediaDeletionBot)
*
[
wiki
-
users
-
leaflet
](
https
:
//github.com/valerio-bozzolan/wiki-users-leaflet/) hosted at [WMF Labs](https://tools.wmflabs.org/it-wiki-users-leaflet/)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 18, 19:27 (4 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2262849
Default Alt Text
README.md (1 KB)
Attached To
Mode
R21 boz-mw: MediaWiki API client
Attached
Detach File
Event Timeline