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
Call to undefined function DeepL\curl_version() in deeplcom\deepl-php\src\Translator.php:738
Here is my code to find this error:
$client = new \GuzzleHttp\Client([
'handler' => new \GuzzleHttp\Handler\StreamHandler()
]);
$translator = new \DeepL\Translator($authKey);
$translator->translateText($text, $source, $target, [
TranslatorOptions::HTTP_CLIENT => $client
]);
So it seems that even when you chance the HttpClient, the Translator Class still tries to use method/functions related to Curl HttpClient for building the user-agend string.
Suggestion to fix:
check which Guzzle handler is used
Only is a handler is used, that extends CurlHandler, set $libraryInfoStr to " curl/$curlVer"
for other Handler, either don`t add this info, or find a way to get similar infos from the other Handler classes
The text was updated successfully, but these errors were encountered:
Thanks for reporting this. I didn't want the spaghetti code in the constructUserAgentString, but it seems it needs to know about a bunch of things to properly report. This will be fixed in the next patch.
Hi @Radon8472 , I tested my changes that remove this just now by building PHP from source without the cURL extension, but deepl-php has curl-ext as part of its requirements at the moment, so it won't install. Do you get this error with the cURL extension installed? You can check this for example with php -i | grep curl. The output is empty when you don't have the extension installed.
Hi @Radon8472 , I tested my changes that remove this just now by building PHP from source without the cURL extension, but deepl-php has curl-ext as part of its requirements at the moment, so it won't install. Do you get this error with the cURL extension installed? You can check this for example with php -i | grep curl. The output is empty when you don't have the extension installed.
You are right. in My local dev system based on xampp, I dont have this error when I activate curl.
But when I push the files to my life system (where I don`t have curl) I get the error.
You are using guzzle, and guzzle can run fine without curl using the native php streams or socket based Handlers, so I would recommend to move the curl dependency from the require section to suggested.
Otherwise you would stop everybody without curl extension from using deepl, and I see no reason for this, when you are using guzzle, what is made to be useable with native php too.
I tried to change the http-client like shown in the README section - Custom HTTP client.
What results in Error:
Here is my code to find this error:
So it seems that even when you chance the HttpClient, the Translator Class still tries to use method/functions related to Curl HttpClient for building the user-agend string.
Suggestion to fix:
$libraryInfoStr
to " curl/$curlVer"The text was updated successfully, but these errors were encountered: