Request Failed
Closed this issue · 16 comments
I just using this package have given in client id and secret but when i am translating its said REQUEST FAILED
Please provide a full dump of the exception, including previous exceptions (just catch the exception and echo it).
I can't understand what's the problem..please help
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.
Actually i am using laravel 4.2..is it bcoz of this or something else....it's not echoing the error too
Can u give me example code or something
Do something like this:
$client = new Curl();
$browser = new Browser($client);
Then see what exception gets thrown.
Nothing hapenning bro???
Did you use this $browser
object to make actual requests to the API?
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:
It is from the translator page I subscribed in azure market. The problem can be caused because this is v1?
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.
@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')
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.
@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.
I'm sorry people, there's nothing I can do here.
make sure you already subscribe to datamarket.azure.com/dataset/bing/microsofttranslator
also your current balance is not zero ..thats it :)