<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9">
<style>
.katman {
border: 2px dotted #5E9BBE;
margin: 0 auto;
width: 250px;
font-family: Verdana;
}
.katman input{
border: 1px solid #5E9BBE;
font-family: Verdana;
font-size: 11pt;
}
</style>
<script>
function kontrol(){
if(document.getElementById('kelime').value=='Kelime girin') {
alert("Kelimeyi girin!");
return false;
}else{
return true;
}
}
function deger1() {
if(document.getElementById('kelime').value=='')
document.getElementById('kelime').value='Kelime girin';
}
function deger2() {
if(document.getElementById('kelime').value=='Kelime girin')
document.getElementById('kelime').value='';
}
</script>
</head>
<body>
<div class="katman" align="center">
<form action="<?PHP $_SERVER['PHP_SELF']?>" method="POST" onSubmit="return kontrol()">
<input type="text" name="kelime" id="kelime" value="Kelime girin" onclick="deger2()" onblur="deger1()">
<input type="submit" name="cevir" value="Çevir" style="background-color:#C6DBE6">
</form>
<?php
if(isset($_POST['cevir'])) {
$kelime = $_POST["kelime"];
$kelime=str_replace(" ","+",$kelime);
echo "<b>$kelime = </b>";
$istek = fopen("http://www.tureng.com/search/$kelime","r");
if(!istek)
echo "Veritabanı ile bağlantı yapılamıyor!";
for($i=0;$i<330;$i++) {
$sonuc = fgets($istek);
}
$sonuc = explode("class",$sonuc);
$sonuc2 = explode(">",$sonuc[2]);
$veri = substr($sonuc2[1],0,-3);
if($veri=='')
$veri="<font color=red size=2><i>Sonuç Bulunamadı</i></font>";
echo "<b>$veri</b>";
}
?>
</div>
</body>
</html>Görsellik olarak geliştirilebilmesi açısından html kullandım. Veritabanı Tureng.com üzerinden kullanılıyor. Demo için: http://ekstremum.com/script/sozluk.php
Şimdilik problem gözükmüyor.