?URLFetch

urls={"http://drorbn.net/api.php", "http://katlas.math.toronto.edu/w/api.php"};
url=urls[[2]];
username="DrorsRobot";
Clear[password];
password:= password=InputString["Password for "<>username<>": "]

{content1, cookies1} = URLFetch[url,
{"Content","Cookies"},
"Parameters" -> {
"action" -> "login", "format" -> "xml","lgname"->username, "lgpassword" -> password
},
"Method"->"POST",
"StoreCookies"->False
];
parsedcontent=Cases[ImportString[content1, "XML"],XMLElement["login",{"result"->"NeedToken",parsedcontent___},{}] :> {parsedcontent},
Infinity
] // First;
{content2, cookies2} = URLFetch[url,
{"Content","Cookies"},
"Parameters" -> {
"action" -> "login", "format" -> "xml", "lgname"->username, "lgpassword" -> password,
"lgtoken" ->  ("token" /. parsedcontent)
},
"Method"->"POST",
"Cookies"-> cookies1,
"StoreCookies"->False
]

{content3, cookies3} = URLFetch[url,
{"Content","Cookies"},
"Parameters" -> {"action" -> "tokens", "format" -> "xml"},
"Method"->"POST",
"Cookies"-> cookies2,
"StoreCookies"->False
];
Print[{content3, cookies3}];
edittoken=Cases[ImportString[content3, "XML"],XMLElement["tokens",{"edittoken"->edittoken_},{}] :> edittoken,
Infinity
] // First

{content4, cookies4} = URLFetch[url,
{"Content","Cookies"},
"Parameters" -> {
"action" -> "edit", "format" -> "xml",
"title" -> "Sandbox",
"text" -> "Robot zubi",
"token" -> edittoken
},
"Method"->"POST",
"Cookies"-> cookies3,
"StoreCookies"->False
]

URLFetch[url,
{"Content","Cookies"},
"Parameters" -> {
"action" -> "query", "format" -> "xml",
"meta" -> "userinfo",
"uiprop" -> "rights"
},
"Method"->"GET",
"Cookies"-> cookies3,
"StoreCookies"->False
]

(*URLFetch[url,
{"Content","Cookies"},
"Parameters" -> {
"action" -> "query",
"titles" -> "Sandbox",
"export" -> "true"
},
"Method"->"GET",
"Cookies"-> cookies3,
"StoreCookies"->False
]*)