statickidz / php-google-translate-free

PHP class to use the Google Translator API for free.
GNU General Public License v3.0
271 stars 91 forks source link

Using Proxy #36

Open Blair2004 opened 3 years ago

Blair2004 commented 3 years ago

Hi, Thank you for your work. I have a question, is there a way to make the library works (makes requests) via a proxy. Because if we do a lot of translation request to Google, somehow the IP gets banned. So, using a proxy might prevent this.

Thanks.

mega94 commented 3 years ago

error: "Google detected unusual traffic from your computer network, try again later (2 - 48 hours)"

ermeh commented 3 years ago

How to use proxy? Will you please let us know?

Blair2004 commented 3 years ago

I thought I have explained already... This consist of using a collection of random IP that can be used to prevent bans from too many request error.

ermeh commented 3 years ago

I know that :) Just asking how we can integrate proxies to this script.

Blair2004 commented 3 years ago

If the script is proceeding request to a remote service I guess the HTTP client should offer such option. I don't know if the scripts use Guzzle, but with that, you can define a proxy client.

https://docs.guzzlephp.org/en/stable/request-options.html#proxy

ermeh commented 3 years ago

I think this question must be replied by the script developer.

Blair2004 commented 3 years ago

When you asked your question, I'm sorry if I believed you were talking to me. I also didn't notice you're highjacking the thread. 😅😅😅

carlosvaldesweb commented 3 years ago

I'm having the same problem, did you solve it?

aydinrzyv commented 3 years ago

I've got the same issue, did anybody solve it?

mcolominas commented 2 years ago

I have a question, can I find out why you want to use a proxy? In case of connecting it and making many requests, Google will ban the proxy's IP, therefore, will it also stop working, or do I forget something?

Blair2004 commented 2 years ago

Me, I fixed this issue a while ago. I'm using a home made script (adonisjs) that is based on the Chrome Extension of Google Translate. That script work far beyond my expectations as it can safely translate an HTML page with tags.

I'm using many different premium proxies to make sure, whatever translation I have to do during a day, I won't get banned. I thinking releasing it as a package for Laravel, I'm just meanwhile very busy.

mcolominas commented 2 years ago

Hello @Blair2004 , by premium proxies you mean paid proxies?

Blair2004 commented 2 years ago

Hello @Blair2004 , by premium proxies you mean paid proxies?

Yes.

mcolominas commented 2 years ago

@Blair2004 I don't know how much money you will be paying to use the proxies, but since you pay, wouldn't it be better for you to use this https://github.com/statickidz/php-google-translate-free/issues/38#issuecomment-979448295? it also has a function to translate html

Blair2004 commented 2 years ago

Hi, I'm paying around $4 monthly, I have created a multilingual (16 languages) blog and so far the tool I created translate very well. Most translation packages :

That's the reason why I stopped using those.

mcolominas commented 2 years ago

So I do not understand it, what I have put in that comment is the translation paid google service, so it would have to be better than the free one and also, if it supports html https://cloud.google.com/translate/docs/reference/rest/v2/translate

If you say that you are already happy with what you use, use that, I'll be waiting for you to take out the package (if you take it out) to see how you have done it.

ermeh commented 1 year ago

Is there anyone who adds proxies to this script and is happy with the way it works?