Как войти в систему cURL и использовать регулярное выражение

Это мой код. Я не знаю, почему он не работает, все кажется прекрасным, может быть?

<form method="POST"> <input name="link"> <button type="submit">></button> </form> <title>GET IMG SRC</title> <?php if (!isset($_POST['link'])) exit(); $link = $_POST['link']; echo '<div id="pin" style="float:center"><textarea class="text" cols="110" rows="50">'; function curl($link) { //username and password of account $username = "test@gmail.com"; $password = "123"; //set the directory for the cookie using defined document root var //$dir = DOC_ROOT."/ctemp"; //build a unique path with every request to store //the info per user with custom func. //$path = build_unique_path($dir); //login form action url $url="https://example.com/member.php?mod=logging&action=login"; $postinfo = "username=".$username."&password=".$password; $cookie_file_path = "cookie.txt"; $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_NOBODY, false); curl_setopt($ch, CURLOPT_URL, $link); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path); //set the cookie the site has for certain features, this is optional curl_setopt($ch, CURLOPT_COOKIE, "cookiename=0"); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_REFERER, $_SERVER['REQUEST_URI']); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postinfo); curl_exec($ch); curl_close($ch); } $get=array(); $get = curl($link); if (preg_match_all('/class="zoom" file="(.*?)"/', $get, $matches)) { // echoing contents foreach ($matches[1] as $content) echo $content."\r\n"; } echo '</textarea>'; ?> 

Я хочу использовать cURL для входа на страницу, которую я представляю в форме, и затем используйте regex для imagae src, я хочу. Затем скрипт экспортирует весь img-url в текстовое поле!