Prezados, preciso utilizar a biblioteca:
https://github.com/guzzle/guzzle
Mas como já vi no
https://forum.scriptcase.com.br/t/resolvido-nfephp-com-composer/17268?u=guipassos
O Scriptcase não funciona com NAMESPACE.
Tentei a alternativa de @evanjos
https://forum.scriptcase.com.br/t/resolvido-nfephp-com-composer/17268/18?u=guipassos
E também a de @Felipe_Ladislau
https://forum.scriptcase.com.br/t/resolvido-nfephp-com-composer/17268/21?u=guipassos
Mas todas retornam Error 500, porém se faço direto pelo PHP, fora do Scriptcase, funciona.
Alguém poderia me ajudar, mostrando o que estou fazendo de errado?
Arquivo index.php:
<?php
	require_once 'vendor/autoload.php';
	use GuzzleHttp\Client;
	use GuzzleHttp\Exception\RequestException;
	use GuzzleHttp\Psr7\Request;
	use GuzzleHttp\Psr7\Response;
	use Corviz\BrGpdpl\Anonymizer\CpfAnonymizer;
?>
onExecute:
sc_include_library("prj", "teste", "index.php", true, true);
// Initialize GuzzleHttp client
$client = new GuzzleHttp\Client();
// Define request parameters
$method = 'GET';
$url = 'https://gateway.apiserpro.serpro.gov.br/consulta-cpf-df-trial/v1/cpf/40442820135';
$headers = [
    'Authorization' => 'Bearer 06aef429-a981-3ec5-a1f8-71d38d86481e'
];
$body = '';
// Define exponential backoff parameters
$maxRetries = 5;
$retryDelay = 1000; // in milliseconds
$retryCount = 0;
// Perform the request with exponential backoff
do {
    try {
        // Create a new request
        $request = new Request($method, $url, $headers, $body);
        // Send the request asynchronously
        $response = $client->sendAsync($request)->wait();
        // Check if the response is successful
        if ($response->getStatusCode() === 200) {
            // Process the response
            echo $response->getBody();
            break; // Break out of the loop on success
        }
    } catch (RequestException $e) {
        // Handle request exceptions
        if ($e->hasResponse() && $e->getResponse()->getStatusCode() === 429) {
            // Retry if rate limit exceeded
            usleep($retryDelay * 1000); // Convert milliseconds to microseconds
            $retryDelay *= 2; // Double the retry delay for exponential backoff
            $retryCount++;
            continue; // Retry the request
        } else {
            // Handle other types of exceptions
            echo 'Error: ' . $e->getMessage();
            break; // Break out of the loop on error
        }
    }
} while ($retryCount < $maxRetries);
if ($retryCount === $maxRetries) {
    echo 'Exceeded maximum number of retries.';
}
Agradeço muito a ajuda, pois não sei mais o que fazer 
      
    

 