matthiasnoback / microsoft-translator

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

Request Failed #14

Closed dhrubo001 closed 8 years ago

dhrubo001 commented 8 years ago

I just using this package have given in client id and secret but when i am translating its said REQUEST FAILED

matthiasnoback commented 8 years ago

Please provide a full dump of the exception, including previous exceptions (just catch the exception and echo it).

dhrubo001 commented 8 years ago

This is the issue i am facing.. error

dhrubo001 commented 8 years ago

I can't understand what's the problem..please help

matthiasnoback commented 8 years ago

I don't know what that means. It seems a PHP error from file_get_contents. You should try to use a different Buzz client, e.g. use the Curl client.

dhrubo001 commented 8 years ago

Actually i am using laravel 4.2..is it bcoz of this or something else....it's not echoing the error too

dhrubo001 commented 8 years ago

Can u give me example code or something

matthiasnoback commented 8 years ago

Do something like this:

$client = new Curl();
$browser = new Browser($client);

Then see what exception gets thrown.

dhrubo001 commented 8 years ago

Nothing hapenning bro???

matthiasnoback commented 8 years ago

Did you use this $browser object to make actual requests to the API?

nagyszem22 commented 8 years ago

I have got the same issue with Laravel 5.2, I have no idea what to do, it seems like my id or my secret is not correct so the authentication process fails. But they are correct I think. This is what worries me: image

It is from the translator page I subscribed in azure market. The problem can be caused because this is v1?

matthiasnoback commented 8 years ago

Sorry guys, I have no recent experience with MicrosoftTranslator at all. There's no guarantees whatsoever that it still works. So: please debug some more. If the exception isn't clear, dump it, or better: use Xdebug to step through until you get to the problem. Also, switch to Curl, etc.

ahmedash95 commented 8 years ago

@matthiasnoback there is something weird about this exception .. it works good at localhost but on the server it gives me this exception exception 'Buzz\Exception\RequestException'

#0 my_project_path/vendor/kriswallsmith/buzz/lib/Buzz/Browser.php(130): Buzz\Client\FileGetContents->send(Object(Buzz\Message\Request), Object(Buzz\Message\Response))
#1 my_project_path/vendor/kriswallsmith/buzz/lib/Buzz/Browser.php(82): Buzz\Browser->send(Object(Buzz\Message\Request))
#2 my_project_path/vendor/kriswallsmith/buzz/lib/Buzz/Browser.php(36): Buzz\Browser->call('https://datamar...', 'POST', Array, 'client_id=3d669...')
#3 my_project_path/vendor/matthiasnoback/microsoft-translator/src/MatthiasNoback/MicrosoftOAuth/AccessTokenProvider.php(83): Buzz\Browser->post('https://datamar...', Array, 'client_id=3d669...')
#4 my_project_path/vendor/matthiasnoback/microsoft-translator/src/MatthiasNoback/MicrosoftOAuth/AccessTokenProvider.php(60): MatthiasNoback\MicrosoftOAuth\AccessTokenProvider->authorize('http://api.micr...', 'client_credenti...')
#5 my_project_path/vendor/matthiasnoback/microsoft-translator/src/MatthiasNoback/MicrosoftTranslator/MicrosoftTranslator.php(227): MatthiasNoback\MicrosoftOAuth\AccessTokenProvider->getAccessToken('http://api.micr...', 'client_credenti...')
#6 my_project_path/vendor/matthiasnoback/microsoft-translator/src/MatthiasNoback/MicrosoftTranslator/MicrosoftTranslator.php(195): MatthiasNoback\MicrosoftTranslator\MicrosoftTranslator->getAccessToken()
#7 my_project_path/vendor/matthiasnoback/microsoft-translator/src/MatthiasNoback/MicrosoftTranslator/MicrosoftTranslator.php(141): MatthiasNoback\MicrosoftTranslator\MicrosoftTranslator->call(Object(MatthiasNoback\MicrosoftTranslator\ApiCall\Speak))
#8 my_project_path/app/Services/TextToSpeach.php(25): MatthiasNoback\MicrosoftTranslator\MicrosoftTranslator->speak('' ?????????????...', 'ar', 'audio/mp3', 'MaxQuality')
matthiasnoback commented 8 years ago

Ah, usually this has something to do with SSL - something about a difference in server time maybe, or the list of accepted certificate authorities, etc. You should definitely not use FileGetContents anyway, try Curl instead, which gives much more detailed error messages anyway.

ahmedash95 commented 8 years ago

@matthiasnoback , after installing ssl and using curl insted of FileGetContnets it still gives me API call was not successful, 400: Bad Request . somtimes it works and somtimes throws this exception .. i tried to figure out what happen but i don't found it yet.

matthiasnoback commented 8 years ago

I'm sorry people, there's nothing I can do here.

fer-ri commented 8 years ago

make sure you already subscribe to datamarket.azure.com/dataset/bing/microsofttranslator also your current balance is not zero ..thats it :)