matthiasnoback / microsoft-translator

PHP library for making calls to the Microsoft Translator V3 API
MIT License
39 stars 26 forks source link

A more detailed reason of why a request has failed #2

Closed afarazit closed 10 years ago

afarazit commented 10 years ago

I'm getting a RequestFailedException with reason Request failed, can you update the library to provide more info about this issue? I can't figure out why it's failing.

matthiasnoback commented 10 years ago

The exception wraps the previous exception which contains the real reason (see https://github.com/matthiasnoback/microsoft-translator/blob/master/src/MatthiasNoback/MicrosoftOAuth/AccessTokenProvider.php#L86), You can retrieve it by calling $exception->getPrevious().

By the way, in such cases I would recommend using Xdebug, to be able debug the process step by step.

afarazit commented 10 years ago

Cheers for the quick reply

matthiasnoback commented 10 years ago

You're welcome!

paazmaya commented 10 years ago

I had similar error, which was due to SSL error. Fix was to use:

$browser = new Browser();
$browser->getClient()->setVerifyPeer(false);
matthiasnoback commented 10 years ago

@paazmaya This does not fix things, but instead introduces a security vulnerability. Turning of peer verification means that the validity of the SSL certificate will not be checked anymore. If your machine can not verify the validity by itself, it's probably missing some configuration. You should fix it at that level, not in the code.

paazmaya commented 10 years ago

@matthiasnoback Thanks for the note, will look at SSL error as it is anyhow Microsoft server where the request is made to...