Examples
banshee/examples-collection/examples/protocols/
http-get-account
Example: http.get with user= and password=, an optional account in Basic.
by banshee1 installation1 version
Published on October 27, 2026. First version in this collection.
// http.get with an account: user= and password= send it in Basic. Here the account is optional: an empty
// user sends none, so the same line serves a page with or without an account.
need('protocol:http');
$user = need('protocol:http:user', 'optional');
$password = need('protocol:http:password', 'optional');
$url = variable('example:page:url', 'text', array(
'label' => 'Address of the page',
'help' => 'For example https://intranet.example/.',
));
output('status', 'number', array('label' => 'Answer code'));
watch.expect('refused', 'Page refused', 'status', array('critical' => array(200)));
// The password is a secret: it goes only into the call, never into a value or a message, and never
// over http://.
$answer = http.get($url, user=$user, password=$password);
value('status', $answer['status']);