PHP code example of ivan-novakov / php-haveibeenpwned-client
1. Go to this page and download the library: Download ivan-novakov/php-haveibeenpwned-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/ */
ivan-novakov / php-haveibeenpwned-client example snippets
use InoHibp\Service;
$service = new Service();
try {
$result = $service->checkEmail($email);
} catch (\Exception $e) {
// handle exception
}
if (null === $result) {
printf("Not pwned\n");
} else {
printf("Pwned on these websites: %s\n", implode(', ', $result));
}
$service = new Service(array(
'use_ssl' => true
));
$service = new Service(array(
'use_ssl' => true,
'ca_file' => /alternative/path/ca-bundle.pem
));
$ php composer.phar create-project ivan-novakov/php-haveibeenpwned-client php-haveibeenpwned-client ~1
$ php composer.phar
bin/hibp.php check [--ssl] [--ca-file="..."] [--plain] [--show-exceptions] email