Hi,
I have a problem with the API and following HTTP-request (PHP-Code):
$message =
"--".$boundary."
Content-Type: application/x-www-form-urlencoded
ignorewarnings=1&token=".urlencode($token)."&filename=".urlencode($new_file)
."&file=".urlencode("file")."&comment=".urlencode($desc)."
--".$boundary."
Content-Type: application/octet-stream
Content-Disposition: form-data; name=\"file\";
filename=\"".$new_file."\"
".$file."
--".$boundary."--";
$query = "POST
".$this->server_dir."/api.php?format=php&action=upload
HTTP/1.1
Host: ".$this->server."
Cookie: ".$this->cookies."
User-Agent: CommonsHelper2/1.0 Beta
(
http://toolserver.org/~commonshelper2/index.php jan(a)toolserver.org)
Content-Type: multipart/form-data; boundary=".$boundary."
Content-Length: ".strlen($message)."
".$message."
\r\n\r\n";
$token is the edit token, $boundary a prefix with the output of time(),
$this->server_dir is "/w", $this->server is
"commons.wikimedia.org"
But when I do this request I get this error (var_dump): array(1) {
["error"]=> array(2) { ["code"]=> string(7)
"notoken" ["info"]=>
string(31) "The token parameter must be set" } }
Can you help me?
Best regards,
Jan