Usa un parser html, tipo

simplehtmldom