Last modified: 2009-05-26 06:03:26 UTC
Created attachment 6153 [details] response from Wikibot I use Wikibot (http://en.wikipedia.org/wiki/User:LivingBot/Wikibot.php5) in my script Test.php: <source lang="php"> <?php //grab class include('Wikibot.php5'); //get user&password $fhUP = fopen("user&password.txt", 'r') or die("Can't open user&password file"); $username = rtrim(fgets($fhUP)); $password = rtrim(fgets($fhUP)); fclose($fhUP); // open file with page names $fhPN = fopen("page_names.txt", 'r') or die("Can't open page_names file"); //create bot $wiki = "en"; $MyBot = new Wikibot($username, $password, $wiki); // get first page $pagename = rtrim(fgets($fhPN)); // process page names $i = 0; echo "\n"; while (!feof($fhPN)) { echo "\nPage " . ++$i . " [[" . $wiki . ":" . $pagename . "]]\n"; $page = $MyBot->get_page($pagename); $out = $MyBot->edit_page($pagename,$page."<br><br>Test ".date("Y-m-d H:i:s"),"test",false,false); // next page $pagename = rtrim(fgets($fhPN)); } fclose($fhPN); ?> </source> File page_names.txt contains two lines: User:Ency/test1 and User:Ency/test2. Execute # php Test.php gives right result with 1st page and for a while obscure with 2nd: Page 1 [[en:User:Ency/test1]] Successfully edited User:Ency/test1.<br /> Page 2 [[en:User:Ency/test2]] Error - <br /> ^^^ Error with put_page called from edit_page.<br /> I found that Wikibot in 221 line ($response = curl_exec($ch);) gives such $response for 1st page: a:1:{s:4:"edit";a:5:s:6:"result";s:7:"Success";s:6:"pageid";i:22950702;s:5:"title";s:15:"User:Ency/test1";s:8:"oldrevid";i:292303690;s:8:"newrevid";i:292303840;}} and for 2nd only html standard error page (see attachment 2 [details]nd_response.html), which is returned after unserialize as empty array. Is it a API bug in 2nd case?
*** This bug has been marked as a duplicate of bug 10733 ***