thomascube
2006-05-25 ed5d29f4b3c57235594931d33dde7cccaf7cd58b
commit | author | age
dd53e2 1 <?php
T 2
3 /*
4  +-----------------------------------------------------------------------+
5  | program/steps/mail/spell.inc                                          |
6  |                                                                       |
7  | This file is part of the RoundCube Webmail client                     |
8  | Copyright (C) 2005, RoundCube Dev. - Switzerland                      |
9  | Licensed under the GNU GPL                                            |
10  |                                                                       |
11  | PURPOSE:                                                              |
12  |   Submit request to Google's spell checking engine                    |
13  |                                                                       |
14  | CREDITS:                                                              |
15  |   Script from GoogieSpell by amix.dk                                  |
16  |                                                                       |
17  +-----------------------------------------------------------------------+
18  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
19  +-----------------------------------------------------------------------+
20
21  $Id$
22
23 */
24
25 $REMOTE_REQUEST = TRUE;
26
27 $google = "www.google.com";
28 $lang = $_GET['lang'];
29 $path = "/tbproxy/spell?lang=$lang";
30 $data = file_get_contents('php://input');
31 $store = "";
32
33 if ($fp = fsockopen($google, 80, $errno, $errstr, 30))
34   {
35   $out = "POST $path HTTP/1.0\r\n";
36   $out .= "Host: $google\r\n";
37   $out .= "Content-Length: " . strlen($data) . "\r\n";
38   $out .= "Content-type: application/x-www-form-urlencoded\r\n";
39   $out .= "Connection: Close\r\n\r\n";
40   $out .= $data;
41   fwrite($fp, $out);
42   while (!feof($fp))
43     $store .= fgets($fp, 128);
44   fclose($fp);
45   }
46
47 print $store;  
48 exit;
49
50 ?>