« Utilisateur:Amgine/mwAPI.php » : différence entre les versions

Contenu supprimé Contenu ajouté
Amgine (discuter | contributions)
updates
Amgine (discuter | contributions)
update
 
Ligne 156 :
$val = $this->execCurl( $postvars );
//debug line
if( false != strlen( $val ) ){
echo "Should parse.\n\n";
}else{
echo "Fail to parse.\n\n";
}
if( false != strlen( $val ) ){
Ligne 171 ⟶ 164 :
}else{
return false;
}
}
/**
* getQuery method
**
* Retrieve and parse a query action
**
* @param $query array Query parameters, as described at
* http://www.mediawiki.org/wiki/API:Query
**/
public function getQuery( $query ){
if( false != isset( $query['titles'] ) || false != isset( $query['pageids'] ) || false != isset( $query['revids']) ){
$postvars = array();
foreach( $edit AS $key => $val ){
$postvars[$key] = $val;
}
// set after the foreach to insure the correct token, format
$postvars['action'] = 'query';
$postvars['token'] = $this->editToken;
$postvars['format'] = 'xml';
$val = $this->execCurl( $postvars );
$this->doParse();
return $val;
}
}
Ligne 199 ⟶ 217 :
}
}
/**
* mwLogout method
**
* Get a logout from the MediaWiki API, destroying the login token
*/
private function mwLogout(){
$postvars = array(
'action' => 'logout',
'format' => 'xml',
);
$val = $this->execCurl( $postvars );
$this->doParse();
}
Ligne 245 ⟶ 278 :
$val = $this->execCurl( $postvars );
$this->doParse();
return $val;
// now what the hell do I do with it?
}
}