3
I’m performing a webscraping
as follows:
$url = 'https://esaj.tjsp.jus.br/cpopg/show.do?processo.codigo=XXXXXXXX&processo.numero=XXXXXXX';
$client = new Client();
$crawler = $client->request('GET', $url);
$movimentacao = $crawler->filter('tbody td')->each(function ($node) {
return explode('Movimentação', $node->text())[0];
});
$descricao1 = explode('Juntada', $movimentacao[2]);
\Log::alert(trim($movimentacao[2]));
dd();
I am bringing the information I need, but if I apply a dd
to analyse the information of $movimentacao[2]
, is displayed to me as follows:
I tried to apply the trim
and the str_replace
, but without success. Someone would know a way to withdraw those empty spaces in an efficient way?
Grateful
I saw that it has tabulation, I think you can remove the tabulation as follows:
trim(preg_replace('/\t+/', '', $string))
or you can use this one:$string = preg_replace('/\s+/', '', $string);
– Edward Ramos
He’s really taking away the tabs, but the spaces remain...
– Betini O. Heleno
Even using this command here?
$string = preg_replace('/\s+/', '', $string);
– Edward Ramos
It was perfectly... practical and fast. Grateful
– Betini O. Heleno
Accept my answer there :D
– Edward Ramos