Archive for the ‘Free Code’ Category

Friday Free Code – Auto Google Translate (php)

Below you will find a handy dandy piece of code that The Kaptain uses to take some content and make it just a little bit more unique.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function googletranslate( $text, $destLang = ‘es’, $srcLang = ‘en’ ) {
 
$text = substr($text,0,1500);
$text = urlencode( $text );
$destLang = urlencode( $destLang );
$srcLang = urlencode( $srcLang );
 
$url = "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=$text&langpair=$srcLang|$destLang";
 
$trans = wpbf_http_get( [...]