Lexicon Posted November 29, 2010 Share Posted November 29, 2010 I am having problems being able to find the data that needs to be posted in various translation websites. I think this is because the translation tools they have are using some kind of flash script to translate? So the new page isn't being loaded using the post data string?? I am not completely sure, anyways... I am using live http headers on firefox to try and get the content for the post data string. The sites I have tried to get the post data from are these: http://www.freetranslation.com/ http://www.free-translator.com/ I can get cURL to visit the page and do everything, I just cant find the post data string. or maybe I am way off here.. Thanks for any help Quote Link to comment Share on other sites More sharing options...
sloth456 Posted November 29, 2010 Share Posted November 29, 2010 textareaResponse-LW_01.asp sequence=&dsttext=&mode=html&username=&password=&Submit=FREE+Translation&charset=UTF-8&template=textareaResponse-ETS.asp&lwSrc=eng&lwDest=ara&lwPair=59&Project=&transType=LW&language=&targetServer=LW&srctext=bla+bla+bla&srcLang=English&dstLang=%3Aeng%3Aara%3A59%3A%3A%3ALW&submitbut=Translate&respSupplier=FREETRANSLATION&resptext= Thats the post string you need. I got it by using live http headers. What you do is open live http headers and freetranslation.com. Untick capture and also clear everything. Enter some text into the form, then before pressing the translate button, go back to live http headers and tick capture. Then press the translate button and under the 'generators' tab in live http headers you'll see the post data as above. To use it do the following: $fp = fopen("cookie.txt", "w"); fclose($fp); function curl_post($url,$data,$proxy,$proxystatus){ $post = curl_init(); curl_setopt($post, CURLOPT_COOKIEJAR, "cookie.txt"); curl_setopt($post, CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt($post, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"); curl_setopt($post, CURLOPT_TIMEOUT, 40); curl_setopt($post, CURLOPT_RETURNTRANSFER, TRUE); if ($proxystatus == 'on') { curl_setopt($post, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($post, CURLOPT_HTTPPROXYTUNNEL, TRUE); curl_setopt($post, CURLOPT_PROXY, $proxy); } curl_setopt($post, CURLOPT_URL, $url); curl_setopt($post, CURLOPT_HEADER, TRUE); curl_setopt($post, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); curl_setopt($post, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($post, CURLOPT_POST, TRUE); curl_setopt($post, CURLOPT_POSTFIELDS, $data); ob_start(); // prevent any output return curl_exec ($post); // execute the curl command ob_end_clean(); // stop preventing output } $response=curl_post('http://www.freetranslation.com/textareaResponse-LW_01.asp','textareaResponse-LW_01.asp sequence=&dsttext=&mode=html&username=&password=&Submit=FREE+Translation&charset=UTF-8&template=textareaResponse-ETS.asp&lwSrc=eng&lwDest=ara&lwPair=59&Project=&transType=LW&language=&targetServer=LW&srctext=bla+bla+bla&srcLang=English&dstLang=%3Aeng%3Aara%3A59%3A%3A%3ALW&submitbut=Translate&respSupplier=FREETRANSLATION&resptext= ','','off'); echo $response; In this data string I'm transalting 'bla bla bla' from english to arabic. Hope that helps! Quote Link to comment Share on other sites More sharing options...
Lexicon Posted November 29, 2010 Author Share Posted November 29, 2010 That's great thank you very much. This is what I was looking for. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.