<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sokolnikov911 / cloudflare-abuse-reports example snippets
use CloudflareAbuse\AbuseReportClient;
$client = new AbuseReportClient('your-cloudflare-api-token');
use CloudflareAbuse\AbuseReportClient;
use CloudflareAbuse\HttpTransport\CurlHttpTransport;
$client = new AbuseReportClient('your-api-token', new CurlHttpTransport(timeout: 60));
use CloudflareAbuse\Request\PhishingReportRequest;
$response = $client->submitReport('account-id', new PhishingReportRequest(
email: '[email protected]',
name: 'Jane Doe',
urls: "https://evil.example.com/login\nhttps://evil.example.com/steal",
justification: 'This page impersonates a bank login form.',
));
echo $response->abuseRand; // report identifier
use CloudflareAbuse\Request\DmcaReportRequest;
$response = $client->submitReport('account-id', new DmcaReportRequest(
email: '[email protected]',
name: 'John Copyright',
urls: 'https://infringing.example.com/stolen-content',
originalWork: 'https://original.example.com/my-work',
address1: '123 Main St',
city: 'New York',
state: 'NY',
country: 'US',
));
use CloudflareAbuse\Request\TrademarkReportRequest;
$response = $client->submitReport('account-id', new TrademarkReportRequest(
email: '[email protected]',
name: 'Legal Team',
urls: 'https://infringing.example.com',
trademarkNumber: 'TM12345',
trademarkOffice: 'USPTO',
trademarkSymbol: 'ACME',
justification: 'Unauthorized use of our registered trademark.',
));
use CloudflareAbuse\Request\GeneralReportRequest;
$response = $client->submitReport('account-id', new GeneralReportRequest(
email: '[email protected]',
name: 'Security Team',
urls: 'https://malicious.example.com',
justification: 'C2 server distributing malware.',
destinationIps: '203.0.113.42',
portsProtocols: '443/TCP',
sourceIps: '198.51.100.1',
));
use CloudflareAbuse\Enum\NotificationOption;
use CloudflareAbuse\Request\ThreatReportRequest;
new ThreatReportRequest(
email: '[email protected]',
name: 'Alice',
urls: 'https://threat.example.com',
hostNotification: NotificationOption::SendAnon,
ownerNotification: NotificationOption::None,
);