hi all i have created this simple curl function to grab translated text from google translate, however after i tested it, i figured that google is blocking curl? here is my simple script: function get_content($url) { $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)'); curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt"); //saved cookies //curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1); //curl_setopt($ch, CURLOPT_PROXY, 'fakeproxy.com:1080'); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); ob_start(); curl_exec ($ch); curl_close ($ch); $string = ob_get_contents(); ob_end_clean(); return $string; } echo get_content("http://translate.google.com.my/translate?u=http://php.net&sl=ar&tl=en&hl=en&ie=UTF-8"); PHP: so simply the output is showing nothing.. any ideas of how to make this work will b appreciated..
well I got something: http://phpieceofcake.com/?45124707 problem is i can't change their server settings so try again P.S. your php code actually isn't php code until you surround it with <?php **php code here** ?>
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); You dont need the above. I have developed a similar technology to use various translators. Its translates 100s of lines per second. Then when google realises we renew IP and continue!