Jump to content

User:Wbm1058/edittalk.php

From Wikipedia, the free encyclopedia
<?php
/** edittalk.php - Sample program to edit a talk page on Wikipedia
 *  Version 1.0
 *
 *  (c) 2021 WBM - http://en.wikipedia.org/wiki/User:Wbm1058
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *   
 *  Developers (add your self here if you worked on the code):
 *    WBM - [[User:Wbm1058]] - May 2021
 **/
ini_set("display_errors", 1);
error_reporting(E_ALL ^ E_NOTICE);
require_once 'botclasses.php';  // Botclasses.php was written by User:Chris_G and is available under the GNU General Public License
include("logininfo.php");

echo "Logging in...\n";
$objwiki = new wikipedia();
$objwiki->login($user, $pass);
echo "...done.\n";

$mytalkpage = "User talk:Wbm1058";
$contents = $objwiki->getpage($mytalkpage);
$contents .= "\n== Test edit ==\nHow ya doin? ~~~~\n";
echo $contents;
$objwiki->edit($mytalkpage,$contents,"Test edit to user talk page using edittalk.php",true,true);

echo "\nMission accomplished.\n\n";

?>