PHP code example of google / cloud-web-security-scanner
1. Go to this page and download the library: Download google/cloud-web-security-scanner 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/ */
google / cloud-web-security-scanner example snippets
use Google\Cloud\WebSecurityScanner\V1beta\ScanConfig;
use Google\Cloud\WebSecurityScanner\V1beta\ScanConfig\UserAgent;
use Google\Cloud\WebSecurityScanner\V1beta\ScanRun\ExecutionState;
use Google\Cloud\WebSecurityScanner\V1beta\WebSecurityScannerClient;
$client = new WebSecurityScannerClient();
$scanConfig = $client->createScanConfig(
WebSecurityScannerClient::projectName('[MY_PROJECT_ID'),
new ScanConfig([
'display_name' => 'Test Scan',
'starting_urls' => ['https://[MY_APPLICATION_ID].appspot.com/'],
'user_agent' => UserAgent::CHROME_LINUX
])
);
$scanRun = $client->startScanRun($scanConfig->getName());
echo 'Scan execution state: ' . ExecutionState::name($scanRun->getExecutionState()) . PHP_EOL;