I get the following error
Warning: file_get_contents(https://.@www.wikidot.com/xml-rpc-api.php): failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized
I am trying to get the pagelist using get.pages-methode.
I wish to get the pages from only one category, but using no attributes, so requesting all the pages of my site it already gives me this error.
If I get this running I have a next question and that is should the attribute categories be a string or an array?
Here is the code I use
function selectPages($site)
//-------------------------------
{
$requestarray=array('site'=>$site);
$request = xmlrpc_encode_request("pages.select",$requestarray);
$context = stream_context_create(array('http' => array(
'method' => "POST",
'header' => "Content-Type: text/xml",
'content' => $request
)));
$file = file_get_contents("https://".$username.":".$key.
"@www.wikidot.com/xml-rpc-api.php", false, $context);
$response = xmlrpc_decode($file);
if ($response && xmlrpc_is_fault($response))
{
print("not-ok");
print($respons);
trigger_error("Wikidot XML-RPC Error:
$response[faultString] ($response[faultCode])");
}
else
{
print("ok");
return ($response);
}
}
A - S I M P L E - P L A N by ARTiZEN a startingpoint for simple wikidot solutions.