I suspect this is because the characters sent are literally '\n' not a newline.
The GET request should probably be something like First+line%0ASecond+line
;
If you can't change the request you can change the replace to escape the slashes:
print str_replace(array("\\r\\n", "\\r", "\\n"), "<br>", $name);