]> git.donarmstrong.com Git - roundcube.git/blob - program/steps/mail/spell.inc
Imported Upstream version 0.1~beta2.2~dfsg
[roundcube.git] / program / steps / mail / spell.inc
1 <?php
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: spell.inc 265 2006-06-25 10:04:45Z thomasb $
22
23 */
24
25 $REMOTE_REQUEST = TRUE;
26
27 $google = "ssl://www.google.com";
28 $port = 443;
29 $lang = $_GET['lang'];
30 $path = "/tbproxy/spell?lang=$lang";
31 $data = file_get_contents('php://input');
32 $store = "";
33
34 if ($fp = fsockopen($google, $port, $errno, $errstr, 30))
35   {
36   $out = "POST $path HTTP/1.0\r\n";
37   $out .= "Host: $google\r\n";
38   $out .= "Content-Length: " . strlen($data) . "\r\n";
39   $out .= "Content-type: application/x-www-form-urlencoded\r\n";
40   $out .= "Connection: Close\r\n\r\n";
41   $out .= $data;
42   fwrite($fp, $out);
43   
44   while (!feof($fp))
45     $store .= fgets($fp, 128);
46   fclose($fp);
47   }
48
49 print $store;  
50 exit;
51
52 ?>