Zend - The PHP Company




HTTP

Add Code


Grabbing Dictionary(2)  

Type: application
Added by: emha
Entered: 18/05/2001
Last modified: 05/12/2000
Rating: *** (4 votes)
Views: 5177
Grabbing English-Indonesian Dictionary from www.kamus.web.id put it in your page. Only display the result from the keyword you search.


<?php
// 
//  Written by Eko M. Hadi
//  email:   aku@ekomhadi.f2s.com 
//  website: http://www.ekomhadi.f2s.com
// 
//  Grabbing English-Indonesian Dictionary
//  from www.kamus.web.id put it in your page.
//  Only display the result from the keyword you search.
//  Remove all image, banner, another unnedded HTML.
//  I hope this is use full for you :)
//
//  This Code Snipped is Public Domain 
//  You may use this code for free, modify it for your purposes, etc. 
//  but keep the name above. 
// 
//  You can't make me responsible for any problems that may appear, 
//  especially NOT for problems with kamus.web.id and especially NOT 
//  if the code may stop working.
// 

$show $HTTP_POST_VARS["show"];
$KATA $HTTP_POST_VARS["kata"];
$PILIH $HTTP_POST_VARS["pilih"];

if(
$show=="yes" && isset($KATA)) {
    
$KATA =  urlencode($KATA);
    
$DATA "kata=$KATA&pilih=$PILIH&submit=Find";
    
$LENGTHstrlen($DATA);

    
$POST=
"POST /english.asp HTTP/1.0
Accept: */*
Referer: http://www.kamus.web.id/english.asp
Accept-Language: in
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)
Host: www.kamus.web.id
Content-Length: 
$LENGTH
Connection: Close
Cache-Control: no-cache

$DATA";
    
$sock fsockopen("www.kamus.web.id"80$errno$errstr25);
    if(
$sock) {
        
fputs($sock"$POSTnn");
        while(!
feof($sock))
            
$ANSWER .= fgets($sock,64);            
        
fclose($sock);
        
$ANSWER substr($ANSWERstrpos($ANSWER"<p><br>")+7);
        
$ANSWER substr($ANSWERstrpos($ANSWER"<center>")+8);
        
$ANSWER substr($ANSWER0strpos($ANSWER"</center>"));
    } else
        
$ANSWER "<b>Sock error: www.kamus.web.id !</b>";

}

?>

<html>
<head>
<title>Kamus</title>
</head>

<body bgcolor="#CCCCFF">

<form method="POST" action="<?=$PHP_SELF?>">
  <table border="0" width="331" cellspacing="1" cellpadding="0">
    <tr>
      <td width="325" colspan="2" bgcolor="#5353C6" height="20"><b><font face="Verdana" size="1" color="#FFFFFF">&nbsp;English - Indonesia</font></b></td>
    </tr>
    <tr>
      <td width="49" bgcolor="#A9B5FF" height="20" align="center"><b><font face="Verdana" size="1">Kata</font></b></td>
      <td width="272" bgcolor="#A9B5FF" height="20"><b><font face="Verdana" size="1"><input type="text" name="kata" size="26" value="<?=$KATA?>" style="border: 1 solid #5353C6">
        <input type="submit" value="  Find  " name="submit" style="background-color: #C1CBFF; color: #5353C6; font-size: 8pt; font-family: Verdana; border: 1 solid #5353C6"></font></b></td>
    </tr>
    <tr>
      <td width="49" bgcolor="#A9B5FF" height="20" align="center">&nbsp;</td>
      <td width="272" bgcolor="#A9B5FF" height="20"><font size="1" face="Verdana"><input type="radio" value="eng" checked name="Pilih">English -
        Indonesia <input type="radio" name="pilih" value="ind">Indonesia - Inggris</font></td>
    </tr>
  </table>
  <input type="hidden" name="show" value="yes">
</form>

<!-- Kamus -->
<?php
echo $ANSWER ."n";
?>
<!-- Kamus -->

<hr noshade size="1">
<font size="1" face="Verdana">Copyright � 2001 <b><a href="http://www.ekomhadi.f2s.com">eko(dot)com</a></b> Powered by </font> <b><a href="http://www.kamus.web.id" target="_blank"><font size="1" face="Verdana">kamus.web.id</font>
</a>
</body>

</html>


Usage Example


See the example


Rate This Script





Search



This Category All Categories