Detect XXE Attacks from Text Input in PHP

composer require cloudmersive/cloudmersive_validate_api_client
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: Apikey
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Apikey', 'YOUR_API_KEY');
$apiInstance = new Swagger\Client\Api\TextInputApi(


new GuzzleHttp\Client(),
$config
);
$value = "value_example"; // string | User-facing text input.
$allow_internet_urls = true; // bool | Optional: Set to true to allow Internet-based dependency URLs for DTDs and other XML External Entitites, set to false to block. Default is false.
$known_safe_urls = "known_safe_urls_example"; // string | Optional: Comma separated list of fully-qualified URLs that will automatically be considered safe.
$known_unsafe_urls = "known_unsafe_urls_example"; // string | Optional: Comma separated list of fully-qualified URLs that will automatically be considered unsafe.
try {
$result = $apiInstance->textInputCheckXxe($value, $allow_internet_urls, $known_safe_urls, $known_unsafe_urls);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling TextInputApi->textInputCheckXxe: ', $e->getMessage(), PHP_EOL;
}
?>

--

--

--

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The Art Of Object Oriented Software: Encapsulation

How I designed a CI/CD setup for Microservice Architecture at zero cost

Generating Continents Procedurally with Distortion Fields

Humans of ACM — Breanna Ovid Nery

How to Configure PostgreSQL for Rails Application On Ubuntu 18.04

A trip to Objectville -Summary of Chapter two of Head First Java

A Simple Program to Get Thousands of Stocks’ Data

How to Make a Serverless Solution for a Charity for $12* a Year

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cloudmersive

Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

More from Medium

Laravel 5: fix swiftmailer’s ‘routines:state_machine:internal’ error

Web server on windows for local development

Mezon Html Report generator

Laravel 8 Eloquent orWhereHas Condition