PHP code example of macfly / yii2-hpoo

1. Go to this page and download the library: Download macfly/yii2-hpoo 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/ */

    

macfly / yii2-hpoo example snippets


return [
	'components' => [
		'hpoo' => [
			'class' => 'macfly\hpoo\components\HpooComponent',
			'url' => 'https://127.0.0.1:8443/oo/rest/v2', // HP-OO central url
			'login' => 'myaccount' // An account with the right to trigger a flow
			'password' => 'mypass' // Password related to the account.
			'timeout' => 5, // Conenction timeout (default: 5 seconds)
			'sslVerifyPeer' => true, // Check ssl certificate (default: true)
			'proxy' => 'tcp://ip:port/' // Proxy to use to access url (optional)
			// etc.
		],
	]
	// ...
];

// Flow UUID
$uuid = '1793b153-0ada-451e-93cd-143c3509e8a4';
// FLOW input args if needed
$args = [
	'input1' => 'myinopout',
	....
];

// Running flow Sync (will give you the end when flow is finnished).
$rp = Yii::$app->hpoo->flowRunSync($uuid, $args);

print_r($rp);

// Running flow Async (will return instantly and give you the flow executionid)
$rp = Yii::$app->hpoo->flowRunAsync($uuid, $args);

// Get a flow status
print_r(Yii::$app->hpoo->flowRunAsync($rp['executionId']));

// Get a flow output
print_r(Yii::$app->hpoo->flowLog($rp['executionId']));