I am using an API and in some cases a feature of it prints on the screen when there are errors (api errors, not PHP). It happens that I call this API via AJAX and it breaks my code since the request ends up generating an invalid JSON.
Is there any way to avoid this in PHP? For example, from a certain passage of the code to another passage, nothing is printed on the screen?
Something like this:
// desativaria impressão de qualquer coisa aqui
$this->soapClient = new SoapClient($wsdlLink);
$retorno = $this->soapClient->testFunction($params);
// ativaria impressão aqui
In the above case when I call testFunction, instead of saving the error in the $ return variable, it prints on the screen.
When you access a SOAP resource you are calling a function pre-established by the SOAP API developer. It turns out that sometimes testFunction prints the error directly and not as callback.
What can I do to resolve this problem?