0

I am work with Microsoft Translator now. I had tried this tutorial:

  1. http://blogs.msdn.com/b/translation/p/phptranslator.aspx

  2. https://code.google.com/p/micrsoft-translator-php-wrapper/

And they do not working properly. I am connected to the internet as well, I couldn't connect to host in tutorial 1 and I got some errors in tutorial 2:

Warning: [function.file-get-contents]: failed to open stream: No connection could be made because the target machine actively refused it. in C:\xampp\htdocs\translate\class\MicrosoftTranslator.class.php on line 158

andrefadila
  • 647
  • 2
  • 9
  • 36
  • Did you provide the proper authentication? If a service like this refused your request then it is almost certainly a problem on your side. – Sverri M. Olsen Apr 17 '13 at 08:07
  • Yap, I have all needed : the account key, client app id, client secret. But not work at all :( – andrefadila Apr 17 '13 at 08:25
  • Can you tell me the errors you got in tutorial #1? Which host did you not connect to? Also, are you sure you have the right ClientID and Client Secret? You can ensure them here: http://blogs.msdn.com/b/translation/p/gettingstarted1.aspx, and also make sure you've subscribed to the translator service. – Laurence Moroney Apr 18 '13 at 03:36
  • Of course I had subscribed translator service, I got an error like this: Notice: Undefined property: stdClass::$error in C:\xampp\htdocs\translatorapiphp\AccessTokenAuthentication.php on line 49 and always got stuck in Exception message – andrefadila Apr 18 '13 at 14:48
  • Can you make sure CURL is installed in your PHP? Details: http://stackoverflow.com/questions/1347146/how-to-enable-curl-in-php-xampp – Laurence Moroney Apr 19 '13 at 20:02

1 Answers1

0

I had the same problem :

Notice: Undefined property: stdClass::$error

I resolved it by simply replacing :

if ( $objResponse->error )

by :

if ( isset($objResponse->error) )
hugsbrugs
  • 3,501
  • 2
  • 29
  • 36