Skip to content

Instantly share code, notes, and snippets.

@Echocage
Created July 28, 2016 01:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Echocage/716750602f8039f1225044ad761dd05a to your computer and use it in GitHub Desktop.
Save Echocage/716750602f8039f1225044ad761dd05a to your computer and use it in GitHub Desktop.
$regex = "/\"([^.+,.+$]+)\"/";
$textEncode = urlencode("Hello world");
$file = file_get_contents("https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=es&dt=t&q=$textEncode");
echo " $file\n";
$file = preg_match($regex, $file, $matches);
echo "matches: $matches[0]";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment