я пытаюсь удалить пустые символы (они выглядят как спам-клавиша - примерно на 1 - 2 строки) Это моя функция
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://google.com/a-good-coffee");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
//sleep(6);
curl_setopt($ch, CURLOPT_POSTFIELDS, "blablabla123abc");
$func = curl_exec($ch);
//$func will return this :
//{ "id": "great_coffee", "object": "amazing", "buff": google }
$data = json_decode($func);
echo $rem = $data-id;
//every time if after the $func is being used the id randomizes
//great_coffee will be good_things
//im okay with that but actually
//good_things will have a lot of white lines, blank characters (it looks like a lot of space has been spammed for about 1-2 lines)
Вывод для $ rem is good_things "
Он имеет большой интервал, поэтому я попробовал str_replace и preg_replace, но они не дали эффекта.
также нет "в выводе $ rem, я просто добавил его так я могу продемонстрировать, сколько пробелов здесь
ожидаемый результат : good_things