I'm trying to get data from tags on a website by using the symfony crawler link this.
foreach ($tables as $table) {
$response = $this->client->get($url, [
'http_errors' => false,
]);
$body = $response->getBody()->getContents();
$crawler = new crawler($body);
$version = $crawler->filter('tr > td');
$i = 1;
while (true) {
if (something) {
break;
}
$tableVersions[$table] = preg_split('/\r\n|\r|\n/', $version->eq($i + 1)->text());
$i++;
}
}
return $tableVersions;
In windows this works, the preg_split nicely splits the words that i wanted to split and put them each separately in an array.
When i print out $version->eq($i + 1)->text()
in windows it looks like this:
word1
word2
word3
In linux it just puts all the strings without any delimiter in the first element of the array like this.
word1word2word3
it's the exact same code. So i'm guessing in windows the crawler returns new line feeds and in linux it doesn't? How should i then get a nice array of all the tags on a html page and then filter them?