PHP code example of hypejunction / elgg-ws-client

1. Go to this page and download the library: Download hypejunction/elgg-ws-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hypejunction / elgg-ws-client example snippets



use \hypeJunction\WebServices\Client;

$client = new Client('http://example.com/', 'apikey_abcdef123466');

// Get a list of user's blogs
$result = $client->get('blog.get_posts', [
    'username' => 'my-username',
]);

// Get a user token to interface on user's behalf
$token = $client->getAuthToken('my-username', 'my-password');

// Post a blog
$result = $client->post('blog.save_post', [
   'title' => 'My blog',
   'description' => 'This is what I am blogging about',
   'excerpt' => 'Me blogging',
   'access_id' => 2, // public
   'tags' => 'blog,misc',
], $token);