Jump to content
Chinese-Forums
  • Sign Up

Tencent qq (Chinese icq)


Recommended Posts

Posted

Google has a translation section? I know altavista has one... babelfish...

Its still slow.. I think its the website. Its " too" heavy for my connection.

sending queries aint that hard :P I hacked a SMS service once :D. But the securcity was really crap

Posted

hehe cool man~! I know sending queries aren't that hard..hehe~ :oops:

As for the speed problem, if you know a good (free) web host in europe, tell me, and i'll put the website up there too.

Posted

there are many places to set up one...

butta could you give me the code for that? Im too lazy to create my "own" translation program :)

Posted

you want the php code to interface the google translator? OK, here is the code that you will need:

/**

* Get a remote file using POST

*

* $url String The url which locates the server, port number, and file.

* $_query String The dat to be sent with the header

* returns String the body of the file if successfull

*/

function fetchURL( $url, $_query ) {

$url_parsed = parse_url($url);

$host = $url_parsed["host"];

$port = $url_parsed["port"];

if ($port==0)

$port = 80;

$path = $url_parsed["path"];

$out = "POST $path HTTP/1.0rn";

$out .= "Host: $hostrn";

$out .= "Content-length: " . strlen($_query) . "rnrn";

$out .= $_query . "rn";

$fp = fsockopen($host, $port, $errno, $errstr, 30);

fwrite($fp, $out);

$body = false;

while (!feof($fp)) {

$s = fgets($fp, 1024);

if ( $body )

$in .= $s;

if ( $s == "rn" )

$body = true;

}

fclose($fp);

return $in;

}

/**

* Tranlate English to Chinese (GB2312)

* Uses http://translate.google.com/translate_t

*

* $text String The English to be translated

* returns String Chinese (GB2312) translated from $text

*/

function translateEnglishToChinese( $text ) {

$data = fetchURL("http://translate.google.com/translate_t", "text=$text&langpair=en%7Czh-CN");

list($junk, $data) = split('<textarea name=q rows=5 cols=45 wrap=PHYSICAL>', $data);

list($translation, $junk) = split('</textarea>', $data);

return $translation;

}

/**

* Tranlate Chinese (GB2312) to English

* Uses http://translate.google.com/translate_t

*

* $text String The Chinese (GB2312) to be translated

* returns String English translated from $text

*/

function translateChineseToEnglish( $text ) {

$data = fetchURL("http://translate.google.com/translate_t", "text=$text&langpair=zh-CN%7Cen");

list($junk, $data) = split('<textarea name=q rows=5 cols=45 wrap=PHYSICAL>', $data);

list($translation, $junk) = split('</textarea>', $data);

return $translation;

}

Posted

I cant read php... though...

I can read Java :P

But it doesnt output a textfield in php

Posted

who want a QQ number?

You can login the follow FREE number in 24 hours:

442021207----qCKXzUqDatyTalN

346429594----ZHfOzxsYcTANfVG

412236646----4LOCYsrWYFqEZB3

379861807----3eUucoVyCWNUMhA

287687318----znEDAVdDXc4MkPL

Remember change the password to your own . Extra questions please contact me .

nings@hotmail.it

Posted

Does anyone have a problem with sending messages through QQ? Tonight, when I tried to send messages, I kept getting something like this:

Last sent message: ": " failed to send(server timeout).

I'm in the United States. Any clue what's going on?

Guest
This topic is now closed to further replies.
×
×
  • Create New...