I understand that this part of the API is not implemented
fully etc, etc. However I am having an issue I can’t get around which is
the following:
&prop is converted by php to the “proportional”
char when sending via post, get, using curl, fopen, file_get_contents.
This whole process works just fine if I execute via the URL in the browser, so
I know it can happen. Is there a way around using &prop=info to get a
token to complete the page creation process? Why is &prop being used
when it’s a reserved html special char? It seems silly to be
blocked by such a little thing but I can’t seem to get around it and
would rather not do this whole thing is javascript since this script will have
a lot of work to do when its complete. My assumption is that many people
will run into this when the api becomes more popular, because who doesn’t
love php?
Thanks,
jason
--Info---
*
MediaWiki: 1.12alpha
* PHP: 5.1.2
(apache2handler)
* MySQL:
5.0.18-log
---Begin PHP Code---
echo "<pre>";
print_r($_POST);
$apiURL = "http://".$_SERVER['HTTP_HOST']."/phpapps/wiki/api.php";
$loginURL =
"action=login&lgname=jkuter&lgpassword=&lgdomain=ad.mathworks.com&format=php";
$getLoginResponse = unserialize(getURL($apiURL,$loginURL));
print_r($getLoginResponse);
$titleURL = "action=query&prop=info&titles=BatPresubmitTest&intoken=edit&lgtoken=".
$getLoginResponse['login']['lgtoken']."&lgusername=".
$getLoginResponse['login']['lgusername']."&lguserid=".
$getLoginResponse['login']['lguserid'].
"&format=php";
$getTitleResponse = unserialize(getURL($apiURL,$titleURL));
print_r($getTitleResponse);
$newPageURL =
"action=query&prop=info&titles=BatPresubmitTest&intoken=edit&lgtoken=".
$getLoginResponse['login']['lgtoken']."&lgusername=".
$getLoginResponse['login']['lgusername']."&lguserid=".
$getLoginResponse['login']['lguserid'].
"&format=php";
//$makeNewPage = unserialize(getURL($apiURL,$newPageURL));
//print_r($makeNewPage);
echo "</pre>";
function getURL($url,$vars){
$ch =
curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,
CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch,CURLOPT_POSTFIELDS,$vars);
$content =
curl_exec($ch);
curl_close($ch);
return $content;
}
---End PHP Code---
---Begin output with &prop---
Array
(
[RCAlink] => Insert link here
[ReqDesRevDoclink] => Insert link here
[LEGORevlink] => Insert link here
[APIClasslink] => Insert link here
[CRChecklistLink] => Insert link here
[CRList] => Insert list here
[TestsAddedDescription] => Insert
description here
[RunSuiteList] => Insert list here
[InteractiveBashingList] => Insert
list here
[BaTStages] => Insert list here
[ForeignFilesMissing] => Insert link
here
[BuildPlatformsList] => Insert list
here
[TestPlatformsList] => Insert list
here
[TestingBottleneck] =>
YNTestingBottleneck
[FinalMergeCheck] => YNFinalMergeCheck
[SubmitJob] => YNSubmitJob
[JobNo] => dsfdsf
[Submit_Checklist] => Submit
)
Array
(
[login] => Array
(
[result] => Success
[lguserid] => 1004
[lgusername] => Jkuter
[lgtoken] => 4ee852dbbe6ad67022af0873aaa21098
[cookieprefix] => inside_wiki
[sessionid] =>
)
)
Array
(
[error] => Array
(
[code] => inpermissiondenied
[info] => Action 'edit' is not allowed for the current user
)
)
--End Output With &prop---
---Begin Output Without &prop---
Array
(
[RCAlink] => Insert link here
[ReqDesRevDoclink] => Insert link here
[LEGORevlink] => Insert link here
[APIClasslink] => Insert link here
[CRChecklistLink] => Insert link here
[CRList] => Insert list here
[TestsAddedDescription] => Insert
description here
[RunSuiteList] => Insert list here
[InteractiveBashingList] => Insert
list here
[BaTStages] => Insert list here
[ForeignFilesMissing] => Insert link
here
[BuildPlatformsList] => Insert list
here
[TestPlatformsList] => Insert list
here
[TestingBottleneck] =>
YNTestingBottleneck
[FinalMergeCheck] => YNFinalMergeCheck
[SubmitJob] => YNSubmitJob
[JobNo] => dsfdsf
[Submit_Checklist] => Submit
)
Array
(
[login] => Array
(
[result] => Success
[lguserid] => 1004
[lgusername] => Jkuter
[lgtoken] => 4ee852dbbe6ad67022af0873aaa21098
[cookieprefix] => inside_wiki
[sessionid] =>
)
)
Array
(
[query] => Array
(
[pages] => Array
(
[-1] => Array
(
[ns] => 0
[title] => BatPresubmitTest
[missing] =>
)
)
)
)
--End Output Without &prop---