Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Translation English into Russian
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01545366
Message ID:
01545426
Views:
59
>>Naomi - thanks for the quick response - how would you automate Google translate?
>
>This works for babelfish.yahoo.com
>
>
>LPARAMETERS lcLanguage,lcText
>
>loIP = create('wwIpStuff') && Instantiate our wwIpStuff Object
>loIP.cHTTPProxyName=""
>IF loIP.HTTPConnect('babelfish.yahoo.com','','',.F.)=0
>	lcTranslation=''
>	loIP.AddPostKey('trtext',lcText)
>	loIP.AddPostKey('ei','UTF-8')
>	loIP.AddPostKey('doit','done')
>	loIP.AddPostKey('intl','1')
>	loIP.AddPostKey('lp','en_'+lcLanguage)
>	lcOutput=""
>	lnSize=0
>	*** Send the POST data and retrieve HTTP result
>	lnResult=loIP.HTTPGetEx('translate_txt',@lcOutput,@lnSize)
>	loIP.HTTPClose
>	IF lnResult=0
>		lcStartText=[<div id="result"><div style="padding:0.6em;">]
>		lnAt=ATC(lcStartText,lcOutput)
>		lcTranslation=SUBSTR(lcOutput,lnAT+LEN(lcStartText),500)
>		lnAT=ATC([</div>],lcTranslation)
>		lcTranslation=LEFT(lcTranslation,lnAT-1)
>		
>		** Convert CHR(10) into spaces
>		lcTranslation=CHRTRAN(lcTranslation,CHR(10),' ')
>		
>		lcTranslation=ALLTRIM(lcTranslation)
>		
>		? "Translation= "+lcTranslation
>	ELSE
>		? 'error2: '+loIP.cerrormsg
>	ENDIF
>ELSE
>	? 'error1: '+loIP.cerrormsg
>ENDIF
>
Wow - I will be testing that over the next 2 days
Specialist in Advertising, Marketing, especially Direct Marketing

I run courses in Business Management and Marketing
Previous
Reply
Map
View

Click here to load this message in the networking platform