PHP code example of xchimx / laravel-urlscan

1. Go to this page and download the library: Download xchimx/laravel-urlscan 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/ */

    

xchimx / laravel-urlscan example snippets


// config/app.php

'providers' => [
    ...
    Xchimx\LaravelUrlScan\UrlScanServiceProvider::class,
    ...
];

'aliases' => [
    ...
    'UrlScan' => Xchimx\LaravelUrlScan\UrlScan::class
    ...
];

php artisan vendor:publish --provider="Xchimx\LaravelUrlScan\UrlScanServiceProvider"

URLSCAN_API="YOUR-API-KEY-SET-HERE"

use Xchimx\LaravelUrlScan\UrlScan;

$user = UrlScan::user()->getQuotas();

$url = 'https://laravel.com/';
$visibility = 'public'; // Options: 'public', 'private', 'unlisted'
$result = UrlScan::scan()->submitUrl($url, $visibility);

$uuid = '358c5c79-b712-4e61-b79e-4a59e3c8b116'; //laravel.com
$getResult = UrlScan::result()->getResult($uuid);
$getScreenshot =  UrlScan::result()->getScreenshot($uuid);

$query = 'page.url.keyword:https\:\/\/www.paypal.com\/*';
$getSearchResults =  UrlScan::search()->search($query);

    public function startScan()
    {
        $url = 'https://laravel.com/';
        $visibility = 'public'; // Options: 'public', 'private', 'unlisted'
        $result = UrlScan::scan()->submitUrl($url, $visibility);

        if (isset($result['uuid'])) {
            sleep(10); //necessary else the scan isn't finished yet
            $getResult = UrlScan::result()->getResult($result['uuid']);
            $getScreenshot = UrlScan::result()->getScreenshot($result['uuid']);
            return [
                'result' => $getResult,
                'screenhots' => $getScreenshot
            ];

        } else {
            return response()->json(['error' => 'UUID not found'], 400);
        }
    }
app.php