Jump to content

Wikipedia:PHP bot functions

From Wikipedia, the free encyclopedia
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Here are the functions provided by some major PHP bot frameworks.

Bot wikibot.classes botclasses.php Phpwikibot Wikibot Pillar
Classes 4 classes (http, wikipediaquery, wikipediaapi, wikipediaindex) 3 classes (http, wikipedia, extended) 1 class (phpwikibot) 1 class (Wikibot) 7 classes (MWRequest, MWSite, Page, Pillar, Request, Site, User)
Post to a url http->post http->post
Get a url http->get http->post
Reinitialize queryurl wikipediaquery->checkurl
Get contents of a page wikipediaquery->getpage wikipedia->getpage phpwikibot->get_page Wikibot->get_page Page->get_text
Get pageid for a page wikipediaquery->getpageid wikipedia->getpageid
Get number of contributions a user has wikipediaquery->contribcount wikipedia->getpagecontribcount
Log you into wikipedia wikipediaapi->login wikipedia->login Wikibot->login
Get tokens wikipediaapi->gettokens wikipedia->getedittoken
Return recent changes for a wiki wikipediaapi->recentchanges
Return search results from wikipedia's internal search engine wikipediaapi->search
Retrieve entries from the wikilog wikipediaapi->logs
Retrieve metadata about a user's contributions wikipediaapi->usercontribs User->get_usercontribs
Return revision data wikipediaapi->revisions
Enumerate user metadata wikipediaapi->users
Get members of a category wikipediaapi->categorymembers wikipedia->categorymembers phpwikibot->category Wikibot->category MWSite->get_categorymembers
Enumerate all categories wikipediaapi->listcategories Wikibot->get_cats_of_page Page->get_categories
Enumerate all backlinks to a page wikipediaapi->backlinks wikipedia->whatlinkshere phpwikibot->backlinks
Get a list of transcludes embedded in a page wikipediaapi->embeddedin Page->get_templates
Get a list of pages with a common prefix wikipediaapi->listprefix
Edit a page wikipediaapi->edit wikipedia->edit phpwikibot->put_page wikibot->edit_page Page->put
Move a page wikipediaapi->move wikipedia->move Page->move
Roll back an edit wikipediaapi->rollback wikipedia->rollback
Post data to a page, nicely wikipediaindex->post
Post data to a page wikipediaindex->forcepost
Get a diff wikipediaindex->diff MWSite->diff
Roll back an edit wikipediaindex->rollback
Move a page wikipediaindex->move
Upload a file wikipediaindex->upload wikipedia->upload MWSite->upload
Send email to a user wikipediaindex->email wikipedia->email User->email
Send a query to the API wikipedia->query
Return a list of pages that include the image wikipedia->whereisincluded MWSite->get_imageuse
Return an array with all the subpages of $page wikipedia->subpages
Login using cookies from old sessions wikipedia->setLogin
Check if we're allowed to edit $page wikipedia->nobots Wikibot->allowBots Page->checkexcluded
Purge the cache of $page wikipedia->purgeCache
Check if $user has email enabled wikipedia->checkEmail
Return all pages $page is transcluded to wikipedia->getTransclusions
Add a text at the bottom of a page wikipedia->addtext
Block a user wikipedia->block User->block
Unblock a user wikipedia->unblock User->unblock
Delete a page wikipedia->delete Page->delete
Undelete a page wikipedia->undelete
Protect/unprotect a page wikipedia->protect Page->protect
Create an account wikipedia->createaccount
Change a user's rights wikipedia->userrights
Get the number of images matching a hash wikipedia->imagematches
Add a category to a page extended->addcategory
Find a string in a page extended->findstring
Replace a string in a page extended->replacestring
Replace all the pages from $page phpwikibot->single_replace
Replace all the pages from $page phpwikibot->multi_replace
Create a new page phpwikibot->create_page Wikibot->create_page
Put a notice template phpwikibot->put_notice
Get the values of a template phpwikibot->get_template
Put the values of a template phpwikibot->put_template
Delete the values of a template phpwikibot->delete_template
Correct the redirect's links phpwikibot->correct_redirect
Manager wiki different from default wiki phpwikibot->wiki Wikibot->wiki
Replace text phpwikibot->replace
Confirm changes by user phpwikibot->confirm Pillar->confirmaction
Replace content of the all pages phpwikibot->replace_all
Edit a page, regardless of whether it exists or not Wikibot->put_page
Call API Wikibot->callAPI
Post API Wikibot->postAPI
Delete cookies Pillar->deletecookies
Force quit Pillar->shutdown
Add a new MediaWiki site to the index Pillar->add_mwsite
Add a new non-MediaWiki site to the index Pillar->add_site
Return the index of sites Pillar->list_sites
Return the site given the id Pillar->get_site
Set current site Pillar->set_cursite
Remove site from the index Pillar->remove_site
Launch from configuration file Pillar->ini_launch
Set the default action to take when doing show changes Pillar->set_browser
Get the default action to take when doing page previews Pillar->get_browser
Set reporting level Pillar->set_reporting
Get reporting level Pillar->get_reporting
Get current page title Page->get_title
Get move protection Page->get_moveprotection
Get edit protection Page->get_editprotection
Get timestamp of last revision Page->get_edittime
Get whether page exists Page->get_exists
Get interwiki language links for this page Page->get_langlinks
Get links in this page Page->get_links
Get images in page Page->get_images
Get external links in a page Page->get_extlinks
Show changes between current page text and $new Page->show_changes
Remove slashes from each end of string Request->remove_slashes
Split headers and body out of raw result Request->split_reply
Get host used in request Request->get_host
Return path to script in request Request->get_path
Return query sent in request Request->get_query
Return additional cURL options sent in request Request->get_opts
Return method used in request Request->get_method
Return raw text Request->get_raw
Return headers Request->get_headers
Return body Request->get_body
Get username User->get_username
Get edit count User->get_editcount
Get block status User->get_blockstatus
Get user groups User->get_groups
Get user registration User->get_registration
Get emailable User->get_emailable
Check is a user is an email address User->is_ip
Get unserialized result MWRequest->get_result
Get plain result MWRequest->get_plain_result
Logout MWSite->logout
Set action confirmations MWSite->set_confirmaction
Get action confirmations MWSite->get_confirmaction
Set maximum loops when server lagged MWSite->set_maxlagloops
Get the maximum number of maxlag loops MWSite->get_maxlagloops
Return bot status MWSite->get_bot
Return admin status MWSite->get_admin
Return login status MWSite->get_loggedin
Return if a user has new messages or not MWSite->get_newmessages
Get pages in which $page is embedded. MWSite->get_embeddedin
Get all pages that link to the external site $url MWSite->get_extlinksto
Get info from Special:Log MWSite->logs
Set a new maximum rate for GET requests Site->set_getrate
Set a new maximum rate for POST requests Site->set_postrate
Set a new maximum rate for all requests Site->set_allrate
Do any necessary throttling before a GET request Site->throttle_get
Do any necessary throttling before a POST request Site->throttle_post