$apiFail = true; $errorMsg = 'Eventbrite API Settings Missing.'; } else { if (!($fp = fsockopen("ssl://www.eventbrite.com", 443, $errno, $errstr, 10))) { $fp = fsockopen("www.eventbrite.com", 80, $errno, $errstr, 10); } if (!$fp) { $apiFail = true; $errorMsg = 'Connection to Eventbrite Service Failed.'; } else { $data = ''; $request = "GET /xml/user_list_organizers?app_key=" . $ebAPI . "&user_key=" . $ebUser . " HTTP/1.1\r\nHost: www.eventbrite.com\r\nConnection: Close\r\n\r\n"; fwrite($fp, $request); while (!feof($fp)) { $data .= fread($fp, 1024); } fclose($fp); $error = xml_elements('error_message', $data); if ($error[0] != '') { $apiFail = true; $errorMsg = 'Error Msg From Eventbrite - <i>' . $error[0] . '</i>'; } else { $elements = xml_elements('organizer', $data); foreach ($elements as $tags) { $found_organizers[xml_tag_value('id', $tags)] = xml_tag_value('name', $tags); } } } } } echo $errorMsg != '' ? $errorMsg : '';
} else { $ebSend .= "&accept_google=0"; } $ebSend .= "&accept_check=0"; $ebSend .= "&accept_cash=0"; $ebSend .= "&accept_invoice=0"; if (!($fp = fsockopen("ssl://www.eventbrite.com", 443, $errno, $errstr, 20))) { $fp = fsockopen("www.eventbrite.com", 80, $errno, $errstr, 20); } if (!$fp) { $apiFail = true; $errorMsg = 'Connection to Eventbrite Service Failed.'; } else { $data = ''; $request = "GET " . $ebSend . " HTTP/1.1\r\nHost: www.eventbrite.com\r\nConnection: Close\r\n\r\n"; fwrite($fp, $request); while (!feof($fp)) { $data .= fread($fp, 1024); } fclose($fp); $error = xml_elements('error_message', $data); if ($error[0] != '') { $apiFail = true; $errorMsg = 'Error Msg From Eventbrite - <i>' . $error[0] . '</i>'; } else { // Successful } } } } echo $errorMsg != '' ? $errorMsg : '';
if (!defined('hcAdmin')) { header("HTTP/1.1 403 No Direct Access"); exit; } $errorMsg = $lat = $lon = ''; if (!($fp = fsockopen("ssl://maps.googleapis.com", 443, $errno, $errstr, 20))) { $fp = fsockopen("maps.googleapis.com", 80, $errno, $errstr, 20); } if (!$fp) { $apiFail = true; $errorMsg = 'Connection to Google Failed.'; } else { $locString = isset($locString) ? clean_accents($locString) : ''; $gSend = "maps.googleapis.com/maps/api/geocode/xml?address=" . urlencode($locString) . "&sensor=false"; $data = ''; $request = "GET " . $gSend . " HTTP/1.1\r\nHost: maps.googleapis.com\r\nConnection: Close\r\n\r\n"; fwrite($fp, $request); while (!feof($fp)) { $data .= fread($fp, 1024); } fclose($fp); $tags = xml_elements('location', $data); if ($tags[0] == '') { $apiFail = true; $errorMsg = 'Geocode Retrieval Failed.'; } else { $lat = xml_tag_value('lat', $tags[0]); $lon = xml_tag_value('lng', $tags[0]); } } echo $errorMsg != '' ? $errorMsg : '';