1. Go to this page and download the library: Download devster/buzz-wsse-plugin 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/ */
devster / buzz-wsse-plugin example snippets
use Buzz\Browser;
use Devster\Buzz\Listener\WsseAuthListener;
// Create a Buzz client
$browser = new Browser();
// and add the Wsse listener
$browser->addListener(new WsseAuthListener('username', '*******'));
// finally use Buzz as usual
$response = $browser->get('http://www.google.com');
echo $browser->getLastRequest()."\n";
echo $response;
use Buzz\Browser;
use Buzz\Message\RequestInterface;
use Devster\Buzz\Listener\WsseAuthListener;
$browser = new Buzz\Browser();
$wsse = new WsseAuthListener('bob', '*********');
$wsse
// Customize the nonce generator
// A callable that must return a string
->setNonceCallback(function(RequestInterface $request) {
return uniqid('myapp_', true);
})
// Customize the timestamp generator
// A callable that must return a string
->setTimestampCallback(function(RequestInterface $request) {
$date = new \DateTime("now");
return $date->format('c');
})
// Customize the digest generator
// A callable that must return a string
->setDigestCallback(function($nonce, $timestamp, $password, RequestInterface $request) {
return hash('sha512', $nonce.$timestamp.$password, true);
})
;
// add the listener to the browser
$browser->addListener($wsse);
shell
# Install Composer
curl -sS https://getcomposer.org/installer | php
# Add the plugin as a dependency
php composer.phar
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.