You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+15-12
Original file line number
Diff line number
Diff line change
@@ -68,21 +68,19 @@ $tr->getResponse($word); // Returns raw array of translated data.
68
68
69
69
### Advanced Configuration
70
70
71
-
This package uses [Guzzle](https://github.com/guzzle/guzzle) for HTTP requests. You can pass an associative array of [guzzle client configuration options](http://guzzle.readthedocs.org/en/5.3/clients.html#creating-a-client) as a third parameter to `TranslateClient` constructor.
71
+
This package uses [Guzzle](https://github.com/guzzle/guzzle) for HTTP requests. You can pass an associative array of [guzzle client configuration options](http://docs.guzzlephp.org/en/latest/request-options.html) as a third parameter to `TranslateClient` constructor.
72
72
73
73
You can configure proxy, user-agent, default headers, connection timeout and so on using this options.
74
74
75
75
```php
76
76
$tr = new TranslateClient(null, 'en', [
77
-
'defaults' => [
78
-
'timeout' => 10,
79
-
'proxy' => [
80
-
'http' => 'tcp://localhost:8125',
81
-
'https' => 'tcp://localhost:9124'
82
-
],
83
-
'headers' => [
84
-
'User-Agent' => 'Foo/5.0 Lorem Ipsum Browser'
85
-
]
77
+
'timeout' => 10,
78
+
'proxy' => [
79
+
'http' => 'tcp://localhost:8125',
80
+
'https' => 'tcp://localhost:9124'
81
+
],
82
+
'headers' => [
83
+
'User-Agent' => 'Foo/5.0 Lorem Ipsum Browser'
86
84
]
87
85
]);
88
86
```
@@ -143,9 +141,14 @@ Both static and non-static `translate()` methods will throw following Exceptions
143
141
144
142
In addition `translate()` method will return boolean `FALSE` if there is no translation available.
145
143
144
+
### Known limitations
145
+
146
+
-`503 Service Unavailable` response:
147
+
If you are getting this error, it is most likely that Google has banned your external IP address and/or [requires you to solve a CAPTCHA](https://github.com/Stichoza/google-translate-php/issues/18). This is not a bug in this package. Google has become stricter, and it seems like they keep lowering the number of allowed requests per IP per a certain amount of time. Try sending less requests to stay under the radar, or change your IP frequently ([for example using proxies](#advanced-configuration)). Please note that once an IP is banned, even if it's only temporary, the ban can last from a few minutes to more than 12-24 hours, as each case is different.
148
+
-`413 Request Entity Too Large` response:
149
+
This error means that your input string is too long. Google only allows a maximum of 5000 characters to be translated at once. If you want to translate a longer text, you can split it to shorter parts, and translate them one-by-one.
150
+
146
151
## Disclaimer
147
152
148
153
This package is developed for educational purposes only. Do not depend on this package as it may break anytime as it is based on crawling the Google Translate website. Consider buying [Official Google Translate API](https://cloud.google.com/translate/) for other types of usage.
149
154
150
-
Also, Google might ban your server IP or [require to solve CAPTCHA](https://github.com/Stichoza/google-translate-php/issues/18) if you send unusual traffic (large amount of data/requests).
0 commit comments