Skip to content

Instantly share code, notes, and snippets.

@brusch
Created July 26, 2018 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brusch/dfc3f2b0be8d226bd68a1bdb74bc4e62 to your computer and use it in GitHub Desktop.
Save brusch/dfc3f2b0be8d226bd68a1bdb74bc4e62 to your computer and use it in GitHub Desktop.
<?php
$client = new \Zend\XmlRpc\Client('https://example.com/rpc/xmlrpc'); // INSERT your hostname
$token = $client->call('confluence2.login', ['USERNAME','PASSWORD']); // INSERT your user + pass
try {
$profilePictureData = file_get_contents('/path/to/your/image/file.jpg'); // INSERT path to the file
$profilePictureData = new \Zend\XmlRpc\Value\Base64($profilePictureData);
// REPLACE "confluence-username" with the username of the user to update
$result = $client->call('confluence2.addProfilePicture', [$token, 'confluence-username', 'file.jpg', 'image/jpg', $profilePictureData]);
} catch (\Exception $e) {
echo $e->getMessage() . "\n";
}
composer require zendframework/zend-xmlrpc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment