xchimx/laravel-urlscan 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

xchimx/laravel-urlscan

最新稳定版本:1.0.2

Composer 安装命令:

composer require xchimx/laravel-urlscan

包简介

This is a package for interaction with the Urlscan.io API

README 文档

README

This is a package for interaction with the Urlscan.io API

Installation

You can install the package via composer:

composer require xchimx/laravel-urlscan

Add the Service Provider and Facade to your app.php config file if you're not using Package Discovery.

// config/app.php

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

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

Publish the config file using the artisan CLI tool:

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

finally set the API Key in your ENV file:

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

Usage

make sure you import Urlscan

use Xchimx\LaravelUrlScan\UrlScan;

User

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

Scan

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

Result

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

Search

use any search terms from Urlscan Search Terms

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

Base combined example

    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);
        }
    }

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-09-23