{"id":4330,"date":"2013-11-20T11:50:09","date_gmt":"2013-11-20T11:50:09","guid":{"rendered":"http:\/\/webkul.com\/blog\/?p=4330"},"modified":"2013-11-20T11:53:53","modified_gmt":"2013-11-20T11:53:53","slug":"usage-google-translator-api-free","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/usage-google-translator-api-free\/","title":{"rendered":"Usage of Google Translator Api For Free"},"content":{"rendered":"<pre class=\"brush:php\">&lt;?php\r\n\r\nfunction curl($url,$params = array(),$is_coockie_set = false){\r\n\r\nif(!$is_coockie_set){\r\n\r\n\/* STEP 1. let\u2019s create a cookie file *\/\r\n$ckfile = tempnam (\"\/tmp\", \"CURLCOOKIE\");\r\n\r\n\/* STEP 2. visit the homepage to set the cookie properly *\/\r\n$ch = curl_init ($url);\r\ncurl_setopt ($ch, CURLOPT_COOKIEJAR, $ckfile);\r\ncurl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);\r\n$output = curl_exec ($ch);\r\n}\r\n\r\n$str = ''; $str_arr= array();\r\nforeach($params as $key =&gt; $value)\r\n{\r\n$str_arr[] = urlencode($key).\"=\".urlencode($value);\r\n}\r\nif(!empty($str_arr))\r\n$str = '?'.implode('&amp;',$str_arr);\r\n\r\n\/* STEP 3. visit cookiepage.php *\/\r\n\r\n$Url = $url.$str;\r\n\r\n$ch = curl_init ($Url);\r\ncurl_setopt ($ch, CURLOPT_COOKIEFILE, $ckfile);\r\ncurl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);\r\n\r\n$output = curl_exec ($ch);\r\nreturn $output;\r\n}\r\n\r\nfunction Translate($word,$conversion = 'hi_to_en')\r\n{\r\n$word = urlencode($word);\r\n\/\/ dutch to english\r\nif($conversion == 'nl_to_en')\r\n$url = 'http:\/\/translate.google.com\/translate_a\/t?client=t&amp;text='.$word.'&amp;hl=en&amp;sl=nl&amp;tl=en&amp;multires=1&amp;otf=2&amp;pc=1&amp;ssel=0&amp;tsel=0&amp;sc=1';\r\n\r\n\/\/ english to hindi\r\nif($conversion == 'en_to_hi')\r\n$url = 'http:\/\/translate.google.com\/translate_a\/t?client=t&amp;text='.$word.'&amp;hl=en&amp;sl=en&amp;tl=hi&amp;ie=UTF-8&amp;oe=UTF-8&amp;multires=1&amp;otf=1&amp;ssel=3&amp;tsel=3&amp;sc=1';\r\n\r\n\/\/ hindi to english\r\nif($conversion == 'hi_to_en')\r\n$url = 'http:\/\/translate.google.com\/translate_a\/t?client=t&amp;text='.$word.'&amp;hl=en&amp;sl=hi&amp;tl=en&amp;ie=UTF-8&amp;oe=UTF-8&amp;multires=1&amp;otf=1&amp;pc=1&amp;trs=1&amp;ssel=3&amp;tsel=6&amp;sc=1';\r\n\r\n\/\/$url = 'http:\/\/translate.google.com\/translate_a\/t?client=t&amp;text='.$word.'&amp;hl=en&amp;sl=nl&amp;tl=en&amp;multires=1&amp;otf=2&amp;pc=1&amp;ssel=0&amp;tsel=0&amp;sc=1';\r\n\r\n$name_en = curl($url);\r\n\r\n$name_en = explode('\"',$name_en);\r\nreturn  $name_en[1];\r\n}\r\n?&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n&lt;meta http-equiv=\"Content-Type\" content=\"text\/html; charset=utf-8\"\/&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;?php\r\necho \"&lt;br&gt;&lt;br&gt; English To Hindi &lt;br&gt; \";\r\necho  Translate('legal notice: This is an abuse of google translator services ,  you must pay for this.','en_to_hi');\r\necho \"&lt;br&gt;&lt;br&gt; Dutch To English &lt;br&gt;\";\r\necho  Translate('Disclaimer: Dit is een misbruik van Google Translator diensten, moet u betalen.','nl_to_en');\r\n\r\n?&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&lt;?php function curl($url,$params = array(),$is_coockie_set = false){ if(!$is_coockie_set){ \/* STEP 1. let\u2019s create a cookie file *\/ $ckfile = tempnam (&#8220;\/tmp&#8221;, &#8220;CURLCOOKIE&#8221;); \/* STEP 2. visit the homepage to set the cookie properly *\/ $ch = curl_init ($url); curl_setopt ($ch, CURLOPT_COOKIEJAR, $ckfile); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); $output = curl_exec ($ch); } $str = &#8221;; $str_arr= <a href=\"https:\/\/webkul.com\/blog\/usage-google-translator-api-free\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":17,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4330","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Usage of Google Translator Api For Free - Webkul Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/usage-google-translator-api-free\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Usage of Google Translator Api For Free - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"&lt;?php function curl($url,$params = array(),$is_coockie_set = false){ if(!$is_coockie_set){ \/* STEP 1. let\u2019s create a cookie file *\/ $ckfile = tempnam (&quot;\/tmp&quot;, &quot;CURLCOOKIE&quot;); \/* STEP 2. visit the homepage to set the cookie properly *\/ $ch = curl_init ($url); curl_setopt ($ch, CURLOPT_COOKIEJAR, $ckfile); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); $output = curl_exec ($ch); } $str = &#039;&#039;; $str_arr= [...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/usage-google-translator-api-free\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2013-11-20T11:50:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-11-20T11:53:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Vipin Sahu\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vipin Sahu\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/usage-google-translator-api-free\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/usage-google-translator-api-free\/\"},\"author\":{\"name\":\"Vipin Sahu\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/fa4c40a8db600fcc1a577383d8cffb23\"},\"headline\":\"Usage of Google Translator Api For Free\",\"datePublished\":\"2013-11-20T11:50:09+00:00\",\"dateModified\":\"2013-11-20T11:53:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/usage-google-translator-api-free\/\"},\"wordCount\":7,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/usage-google-translator-api-free\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/usage-google-translator-api-free\/\",\"url\":\"https:\/\/webkul.com\/blog\/usage-google-translator-api-free\/\",\"name\":\"Usage of Google Translator Api For Free - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"datePublished\":\"2013-11-20T11:50:09+00:00\",\"dateModified\":\"2013-11-20T11:53:53+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/usage-google-translator-api-free\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/usage-google-translator-api-free\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/usage-google-translator-api-free\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Usage of Google Translator Api For Free\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/fa4c40a8db600fcc1a577383d8cffb23\",\"name\":\"Vipin Sahu\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6314b14f75289e2f7427a6d2fa4f23107bc96adadf9dd7db99164ad4e82932c5?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6314b14f75289e2f7427a6d2fa4f23107bc96adadf9dd7db99164ad4e82932c5?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Vipin Sahu\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/sanchit\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Usage of Google Translator Api For Free - Webkul Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/usage-google-translator-api-free\/","og_locale":"en_US","og_type":"article","og_title":"Usage of Google Translator Api For Free - Webkul Blog","og_description":"&lt;?php function curl($url,$params = array(),$is_coockie_set = false){ if(!$is_coockie_set){ \/* STEP 1. let\u2019s create a cookie file *\/ $ckfile = tempnam (\"\/tmp\", \"CURLCOOKIE\"); \/* STEP 2. visit the homepage to set the cookie properly *\/ $ch = curl_init ($url); curl_setopt ($ch, CURLOPT_COOKIEJAR, $ckfile); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); $output = curl_exec ($ch); } $str = ''; $str_arr= [...]","og_url":"https:\/\/webkul.com\/blog\/usage-google-translator-api-free\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2013-11-20T11:50:09+00:00","article_modified_time":"2013-11-20T11:53:53+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png","type":"image\/png"}],"author":"Vipin Sahu","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Vipin Sahu","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/usage-google-translator-api-free\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/usage-google-translator-api-free\/"},"author":{"name":"Vipin Sahu","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/fa4c40a8db600fcc1a577383d8cffb23"},"headline":"Usage of Google Translator Api For Free","datePublished":"2013-11-20T11:50:09+00:00","dateModified":"2013-11-20T11:53:53+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/usage-google-translator-api-free\/"},"wordCount":7,"commentCount":1,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/usage-google-translator-api-free\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/usage-google-translator-api-free\/","url":"https:\/\/webkul.com\/blog\/usage-google-translator-api-free\/","name":"Usage of Google Translator Api For Free - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"datePublished":"2013-11-20T11:50:09+00:00","dateModified":"2013-11-20T11:53:53+00:00","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/usage-google-translator-api-free\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/usage-google-translator-api-free\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/usage-google-translator-api-free\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Usage of Google Translator Api For Free"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/fa4c40a8db600fcc1a577383d8cffb23","name":"Vipin Sahu","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6314b14f75289e2f7427a6d2fa4f23107bc96adadf9dd7db99164ad4e82932c5?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6314b14f75289e2f7427a6d2fa4f23107bc96adadf9dd7db99164ad4e82932c5?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Vipin Sahu"},"url":"https:\/\/webkul.com\/blog\/author\/sanchit\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/4330","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=4330"}],"version-history":[{"count":4,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/4330\/revisions"}],"predecessor-version":[{"id":4334,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/4330\/revisions\/4334"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=4330"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=4330"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=4330"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}