Function used to loop through IPs and make JSON requests