If the defendant is brought before a magistrate of another county for the purpose of giving bail, the magistrate must proceed in respect thereto in the same manner as if the defendant had been brought before him upon a warrant of arrest, and the same proceedings must be had thereon.