whos-online with php 7.2.2? (resolved!)

I haven’t heard of anyone figuring out how to use the new data, but I posted the following to a discussion on WXForum.

"I tried using several online lookup sites and settled on https://ipapi.co/ as the best. Their free plan is limited to 30,000 lookups/month which is more than adequate for my little hobby web site. So, save a copy of your files and then try this if you wish. - Jim

In include-whos-online-page.php I commented out the lines that contained “TEXT_LAST_UPDATED” so I wouldn’t get the update messages.

Then in include-whos-online-header.php I renamed the function get_location_info to old_get_location_info and added the following right above it:"

function get_location_info($user_ip) {
	global $C; 
	
	$ch = curl_init('https://ipapi.co/'.$user_ip.'/json/');
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Macintosh; Intel Mac OS X x.y; rv:42.0) Trident/5.0 Firefox/42.0');
	curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);                 // connection timeout
	curl_setopt($ch, CURLOPT_TIMEOUT, 5);                        // data timeout
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);              // return the data transfer
	curl_setopt($ch, CURLOPT_NOBODY, false);                     // set nobody	
	$json = curl_exec($ch);
	curl_close($ch);
	$record = json_decode($json, true);
	if (strpos($json,"error") == 0 && $record[country_name] != "") { 	
		$record[city] = str_replace("City of ", "", $record[city]);
		$location_info = array();    // Create Result Array	
		$location_info['provider']     = '';
		$location_info['city_name']    = $record[city];
		$location_info['state_name']   = $record[region];
		$location_info['state_code']   = strtoupper($record[region_code]);
		$location_info['country_name'] = ($record[country_name] != '') ? $record[country_name] : '--';
		$location_info['country_code'] = ($record[country] != '') ? strtoupper($record[country]) : '--';
		$location_info['latitude']     = ($record[latitude]  != '') ? $record[latitude]  : '0';
		$location_info['longitude']    = ($record[longitude] != '') ? $record[longitude] : '0';		
	} else {
		$location_info = old_get_location_info($user_ip);         // use the outdated database
	} 	
	return $location_info;
}