1
This commit is contained in:
commit
16acea4957
55
convert.php
Normal file
55
convert.php
Normal file
@ -0,0 +1,55 @@
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
function copyToClipboard(text) {
|
||||
navigator.clipboard.writeText(text)
|
||||
.then(() => {
|
||||
console.log('Text copied to clipboard successfully');
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Error copying text to clipboard:', error);
|
||||
});
|
||||
}
|
||||
function copyUrl() {
|
||||
var urlText = document.getElementById('convertedUrl').textContent;
|
||||
copyToClipboard(urlText);
|
||||
setTimeout(function() {
|
||||
window.close()
|
||||
}, 100);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="copyUrl()">
|
||||
<?php
|
||||
|
||||
function url_to_utf8_string($url) {
|
||||
$parsed_url = parse_url($url);
|
||||
$scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : '';
|
||||
$host = isset($parsed_url['host']) ? $parsed_url['host'] : '';
|
||||
$port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : '';
|
||||
$path = isset($parsed_url['path']) ? urldecode($parsed_url['path']) : '';
|
||||
$query = isset($parsed_url['query']) ? '?' . urldecode($parsed_url['query']) : '';
|
||||
$fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : '';
|
||||
$utf8_url = $scheme . $host . $port . $path . $query . $fragment;
|
||||
return $utf8_url;
|
||||
}
|
||||
|
||||
if (isset($_POST['url'])) {
|
||||
$input_url = $_POST['url'];
|
||||
$utf8_url = url_to_utf8_string($input_url);
|
||||
}
|
||||
|
||||
if(isset($_GET['url'])) {
|
||||
$input_url = $_GET['url'];
|
||||
$utf8_url = url_to_utf8_string($input_url);
|
||||
}
|
||||
?>
|
||||
<h2>Converted URL:</h2>
|
||||
<p id="convertedUrl"><?php
|
||||
if (isset($utf8_url) ) {
|
||||
echo htmlspecialchars($utf8_url);
|
||||
}
|
||||
?></p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
20
index.html
Normal file
20
index.html
Normal file
@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>URL to UTF-8 Converter</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>URL to UTF-8 Converter</h1>
|
||||
|
||||
<form action="convert.php" method="post">
|
||||
<label for="url">Enter URL:</label><br>
|
||||
<input type="text" id="url" name="url" size="50"><br><br>
|
||||
<input type="submit" value="Convert">
|
||||
</form>
|
||||
|
||||
<a href="javascript:window.open('https://www.ngtech.co.il/convert-url/convert.php?url='+encodeURIComponent(window.location.href));">Convert and Open Scriplet</a>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user