PHP code example of rattfieldnz / safe-urls
1. Go to this page and download the library: Download rattfieldnz/safe-urls 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/ */
rattfieldnz / safe-urls example snippets
@if(isset(SafeUrls::check($urls, true)["response"]["matches"]))
<p>There are {{ count(SafeUrls::check($urls, true)["response"]["matches"]) }} dangerous URLs.</p>
@else
<p>No results were found</p>
@endif
$urls = [
'http://www.yahoo.com/'
'http://www.google.com/'
'http://malware.testing.google.test/testing/malware/'
'http://twitter.com/'
'http://ianfette.org'
'https://github.com/'
'https://testsafebrowsing.appspot.com/s/phishing.html'
'https://testsafebrowsing.appspot.com/s/malware.html'
'http://testsafebrowsing.appspot.com/apiv4/ANY_PLATFORM/MALWARE/URL/'
'http://testsafebrowsing.appspot.com/apiv4/ANY_PLATFORM/SOCIAL_ENGINEERING/URL/'
];
[
"status" => 200,
"response" =>
[
"matches" => [
[
"threatType" => "MALWARE",
"platformType" => "ANY_PLATFORM",
"threat" => [
"url" => "http://malware.testing.google.test/testing/malware/"
],
"cacheDuration" => "300s",
"threatEntryType" => "URL"
],
[
"threatType" => "SOCIAL_ENGINEERING",
"platformType" => "ANY_PLATFORM",
"threat" => [
"url" => "http://malware.testing.google.test/testing/malware/"
],
"cacheDuration" => "300s",
"threatEntryType" => "URL"
],
[
"threatType" => "SOCIAL_ENGINEERING",
"platformType" => "ANY_PLATFORM",
"threat" => [
"url" => "https://testsafebrowsing.appspot.com/s/phishing.html"
],
"cacheDuration" => "300s",
"threatEntryType" => "URL"
],
[
"threatType" => "MALWARE",
"platformType" => "ANY_PLATFORM",
"threat" => [
"url" => "https://testsafebrowsing.appspot.com/s/malware.html"
],
"cacheDuration" => "300s",
"threatEntryType" => "URL"
],
[
"threatType" => "MALWARE",
"platformType" => "ANY_PLATFORM",
"threat" => [
"url" => "http://testsafebrowsing.appspot.com/apiv4/ANY_PLATFORM/MALWARE/URL/"
],
"cacheDuration" => "300s",
"threatEntryType" => "URL"
],
[
"threatType" => "SOCIAL_ENGINEERING",
"platformType" => "ANY_PLATFORM",
"threat" => [
"url" => "http://testsafebrowsing.appspot.com/apiv4/ANY_PLATFORM/SOCIAL_ENGINEERING/URL/"
],
"cacheDuration" => "300s",
"threatEntryType" => "URL"
],
],
],
]
php
RattfieldNz\SafeUrls\SafeUrlsServiceProvider::class,
php
'SafeUrls' => RattfieldNz\SafeUrls\Facades\SafeUrlsFacade::class,
bash
php artisan vendor:publish