Beautify HTML from an input string or url.
.Maui HTML Beautify API to beautify HTML documents from an input string or url.
POSTGET *https://api.dotmaui.com/client/1.0/htmlbeautify/
Parameters
| Field | Type | Description | Required |
|---|---|---|---|
| apikey | String |
.Maui Api key |
True |
| html | String |
Valid HTML code |
1 |
| url | String |
Valid URL to a HTML file |
1 |
1 There must be one of these values
Success 200 - Default Mode
It will be a string with HTML indented code
HTTP/1.1 200 OK
<!DOCTYPE html>
<html>
<body>
<h1>
My First Heading
</h1>
<p>
My first paragraph.
</p>
</body>
</html>
Examples
import urllib.parse
import urllib.request
html_string = "<!DOCTYPE html><html><body><h1>My First Heading</h1><p>My first paragraph.</p></body></html>"
params = urllib.parse.urlencode({'apikey': 'YOUR_API_KEY', 'html': html_string}).encode("utf-8")
beautiful = urllib.request.urlopen("https://api.dotmaui.com/client/1.0/htmlbeautify/", data = params).read().decode("utf-8")
print(beautiful)
#<!DOCTYPE html>
#<html>
# <body>
# <h1>
# My First Heading
# </h1>
# <p>
# My first paragraph.
# </p>
# </body>
#</html>
<?php
$data = array('apikey' => 'YOUR_API_KEY',
'url' => "https://example.com");
$curl = curl_init("https://api.dotmaui.com/client/1.0/htmlbeautify/");
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($curl);
curl_close($curl);
echo $output;