Commit f35ca992 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Telematica ass2: finished report.

parent e583dcd7
...@@ -80,7 +80,14 @@ front of the function call. We can safely do this because we handle any ...@@ -80,7 +80,14 @@ front of the function call. We can safely do this because we handle any
failures manually. The two most probable reasons for a ``bad request'' to occur, failures manually. The two most probable reasons for a ``bad request'' to occur,
are the lack of an internet connection and the invalidness of a specified are the lack of an internet connection and the invalidness of a specified
source/target language. Since both are critical for the program's ability to source/target language. Since both are critical for the program's ability to
function correctly, we have chosen to end the program after a bad request. function correctly, we have chosen to end the program after a bad request. If
the request is succesful, we use the built in PHP function \texttt{json\_decode}
to parse the response. The converts the JSON object into an associative array,
form which we can easily extract the translation:
\begin{verbatim}
return $response["data"]["translations"][0]["translatedText"];
\end{verbatim}
% }}} % }}}
\end{document} \end{document}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment