2025-01-18T06:14:42+01:00
<?php
$str_texte = '';
$str_code = '';
if (isset($_REQUEST['texte']) && is_string($_REQUEST['texte']) && strlen($_REQUEST['texte'])
&& isset($_REQUEST['bouton']) && is_string($_REQUEST['bouton']))
{
$str_texte = $_REQUEST['texte'];
$obj_curl = curl_init();
if ($obj_curl)
{
curl_setopt($obj_curl, CURLOPT_URL, $str_texte);
curl_setopt($obj_curl, CURLOPT_HEADER, 0); // false
curl_setopt($obj_curl, CURLOPT_HTTPGET, 1); // true
curl_setopt($obj_curl, CURLOPT_RETURNTRANSFER, 1); // true
curl_setopt($obj_curl, CURLOPT_CONNECTTIMEOUT, 10); // 1 seconde
curl_setopt($obj_curl, CURLOPT_TIMEOUT, 10); // 1 seconde
curl_setopt($obj_curl, CURLOPT_SSL_VERIFYPEER, 0); // false
$str_code = curl_exec($obj_curl);
if ($str_code === FALSE)
{
$str_code = curl_error($obj_curl);
}
curl_close($obj_curl);
}
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Exécuter une requête http</title>
<style type="text/css">
<!--
body *
{
font-family: monospace;
font-size: 8pt;
}
input.texte
{
width: 600px;
}
form
{
margin: 0;
}
div
{
margin: 0 0 5px 0;
}
-->
</style>
<script type="text/javascript">
<!--;
function on_load()
{
if (document && document.getElementById)
{
var obj_input = document.getElementById('texte');
if (obj_input && obj_input.focus)
{
obj_input.focus();
}
}
}
//-->
</script>
</head>
<body onload="on_load();">
<form method="post" action="">
<div>
<input id="texte" name="texte" class="texte" value="<?php echo htmlspecialchars($str_texte, ENT_QUOTES, 'ISO-8859-15'); ?>" />
</div>
<div>
<input type="submit" class="submit" name="bouton" value="Exécuter" />
</div>
</form>
<?php
if ($str_code)
{
$int_ligne = substr_count($str_code, "\n") + 2;
echo '<div><textarea class="texte" cols="80" rows="',$int_ligne,'">' ,htmlspecialchars($str_code, ENT_QUOTES, 'ISO-8859-15'),'</textarea></div>';
}
echo '<p>'.date('c').'</p>';
echo '<hr />';
highlight_file(__FILE__);
?>
</body>
</html>