I have a bunch of links. I need to extract the title from them. So, I want to make textarea to paste links and button like "get the title" to extract titles. I made a function to extract the title from one URL. It works fine. I'm a newbie in PHP and I don't know how to detect line break to get urls. Could anyone help me?

This is my code

```
<?php
 function getTitle($url) {
 $data = file_get_contents($url);
$title = preg_match('/<title[^>]*>(.*?)<\/title>/ims', $data, $matches) ? $matches[1] : null;
return $title;
 }

 echo getTitle('http://example.com');
 ?>

```