Tu código no va tan desencaminado.
Puedes probar con preg_match_all para no tenerlo en el bucle, y después recorrer las coincidencias.
Algo así:
Código PHP:
$content = file_get_contents("http://www.milanuncios.com/motor/");
preg_match_all('|<div class=x7>(.*?)<br>|is', $content , $matchs);
foreach($matchs[1] as $titulo) echo $titulo;
Pero sí, suele ser más facil recurrir al dom ;)