Skip to content

Commit 518c51b

Browse files
Fix PHP SDK examples
1 parent 6df0304 commit 518c51b

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

php/examples/VaasExample/GetVerdictByFile.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace VaasExamples;
44

55
use VaasSdk\Authentication\ClientCredentialsGrantAuthenticator;
6+
use VaasSdk\Options\VaasOptions;
67
use VaasSdk\Vaas;
78

89
include_once("./vendor/autoload.php");
@@ -14,11 +15,18 @@
1415
tokenUrl: getenv("TOKEN_URL")
1516
);
1617

18+
$options = new VaasOptions(
19+
useHashLookup: true,
20+
useCache: true,
21+
vaasUrl: getenv("VAAS_URL"),
22+
timeout: 300
23+
);
24+
1725
$vaas = Vaas::builder()
1826
->withAuthenticator($authenticator)
27+
->withOptions($options)
1928
->build();
2029

21-
2230
$scanPath = getenv("SCAN_PATH");
2331
$vaasVerdict = $vaas->forFileAsync($scanPath)->await();
2432

php/examples/VaasExample/GetVerdictByHash.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace VaasExamples;
44

55
use VaasSdk\Authentication\ClientCredentialsGrantAuthenticator;
6+
use VaasSdk\Options\VaasOptions;
67
use VaasSdk\Sha256;
78
use VaasSdk\Vaas;
89

@@ -15,11 +16,18 @@
1516
tokenUrl: getenv("TOKEN_URL")
1617
);
1718

19+
$options = new VaasOptions(
20+
useHashLookup: true,
21+
useCache: true,
22+
vaasUrl: getenv("VAAS_URL"),
23+
timeout: 300
24+
);
25+
1826
$vaas = Vaas::builder()
1927
->withAuthenticator($authenticator)
28+
->withOptions($options)
2029
->build();
2130

22-
2331
// Malicious hash
2432
$vaasVerdict = $vaas->forSha256Async(Sha256::TryFromString("000005c43196142f01d615a67b7da8a53cb0172f8e9317a2ec9a0a39a1da6fe8")->await())->await();
2533
fwrite(STDOUT, "Verdict for $vaasVerdict->sha256 is " . $vaasVerdict->verdict->value . " \n");

php/examples/VaasExample/GetVerdictByUrl.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace VaasExamples;
44

55
use VaasSdk\Authentication\ClientCredentialsGrantAuthenticator;
6+
use VaasSdk\Options\VaasOptions;
67
use VaasSdk\Vaas;
78

89
include_once("./vendor/autoload.php");
@@ -14,11 +15,18 @@
1415
tokenUrl: getenv("TOKEN_URL")
1516
);
1617

18+
$options = new VaasOptions(
19+
useHashLookup: true,
20+
useCache: true,
21+
vaasUrl: getenv("VAAS_URL"),
22+
timeout: 300
23+
);
24+
1725
$vaas = Vaas::builder()
1826
->withAuthenticator($authenticator)
27+
->withOptions($options)
1928
->build();
2029

21-
2230
// EICAR
2331
$vaasVerdict = $vaas->forUrlAsync("https://secure.eicar.org/eicar.com")->await();
2432
fwrite(STDOUT, "Verdict for $vaasVerdict->sha256 is " . $vaasVerdict->verdict->value . " \n");

0 commit comments

Comments
 (0)