"United States",
"Canada" => "Canada",
"Afghanistan" => "Afghanistan",
"Aland Islands" => "Aland Islands",
"Albania" => "Albania",
"Algeria" => "Algeria",
"American Samoa" => "American Samoa",
"Andorra" => "Andorra",
"Angola" => "Angola",
"Anguilla" => "Anguilla",
"Antarctica" => "Antarctica",
"Antigua and Barbuda" => "Antigua and Barbuda",
"Argentina" => "Argentina",
"Armenia" => "Armenia",
"Azores" => "Azores",
"Aruba" => "Aruba",
"Australia" => "Australia",
"Austria" => "Austria",
"Azerbaijan" => "Azerbaijan",
"Bahamas" => "Bahamas",
"Bahrain" => "Bahrain",
"Bangladesh" => "Bangladesh",
"Barbados" => "Barbados",
"Belarus" => "Belarus",
"Belgium" => "Belgium",
"Belize" => "Belize",
"Benin" => "Benin",
"Bermuda" => "Bermuda",
"Bhutan" => "Bhutan",
"Bolivia" => "Bolivia",
"Bosnia and Herzegovina" => "Bosnia and Herzegovina",
"Botswana" => "Botswana",
"Bouvet Island" => "Bouvet Island",
"Brazil" => "Brazil",
"British Indian Ocean Territory" => "British Indian Ocean Territory",
"Brunei Darussalam" => "Brunei Darussalam",
"Bulgaria" => "Bulgaria",
"Burkina Faso" => "Burkina Faso",
"Burundi" => "Burundi",
"Cambodia" => "Cambodia",
"Cameroon" => "Cameroon",
"Canada" => "Canada",
"Canary Islands" => "Canary Islands",
"Cape Verde" => "Cape Verde",
"Cayman Islands" => "Cayman Islands",
"Central African Republic" => "Central African Republic",
"Chad" => "Chad",
"Channel Islands" => "Channel Islands",
"Chile" => "Chile",
"China" => "China",
"Christmas Island" => "Christmas Island",
"Cocos (Keeling) Islands" => "Cocos (Keeling) Islands",
"Colombia" => "Colombia",
"Comoros" => "Comoros",
"Congo" => "Congo",
"Cook Islands" => "Cook Islands",
"Costa Rica" => "Costa Rica",
"Croatia (Hrvatska)" => "Croatia (Hrvatska)",
"Cuba" => "Cuba",
"Cyprus" => "Cyprus",
"Czech Republic" => "Czech Republic",
"Czechoslovakia (former)" => "Czechoslovakia (former)",
"Democratic Republic of the Congo" => "Democratic Republic of the Congo",
"Denmark" => "Denmark",
"Djibouti" => "Djibouti",
"Dominica" => "Dominica",
"Dominican Republic" => "Dominican Republic",
"East Timor" => "East Timor",
"Ecuador" => "Ecuador",
"Egypt" => "Egypt",
"El Salvador" => "El Salvador",
"Equatorial Guinea" => "Equatorial Guinea",
"Eritrea" => "Eritrea",
"Estonia" => "Estonia",
"Ethiopia" => "Ethiopia",
"Falkland Islands (Malvinas)" => "Falkland Islands (Malvinas)",
"Faroe Islands" => "Faroe Islands",
"Fiji" => "Fiji",
"Finland" => "Finland",
"France" => "France",
"French Guiana" => "French Guiana",
"French Polynesia" => "French Polynesia",
"French Southern Territories" => "French Southern Territories",
"Gabon" => "Gabon",
"Gambia" => "Gambia",
"Georgia" => "Georgia",
"Germany" => "Germany",
"Ghana" => "Ghana",
"Gibraltar" => "Gibraltar",
"Greece" => "Greece",
"Greenland" => "Greenland",
"Grenada" => "Grenada",
"Guadeloupe" => "Guadeloupe",
"Guam" => "Guam",
"Guatemala" => "Guatemala",
"Guinea" => "Guinea",
"Guinea-Bissau" => "Guinea-Bissau",
"Guyana" => "Guyana",
"Haiti" => "Haiti",
"Heard and McDonald Islands" => "Heard and McDonald Islands",
"Honduras" => "Honduras",
"Hong Kong" => "Hong Kong",
"Hungary" => "Hungary",
"Iceland" => "Iceland",
"India" => "India",
"Indonesia" => "Indonesia",
"Iran" => "Iran",
"Iraq" => "Iraq",
"Ireland" => "Ireland",
"Isle of Man" => "Isle of Man",
"Israel" => "Israel",
"Italy" => "Italy",
"Ivory Coast" => "Ivory Coast",
"Jamaica" => "Jamaica",
"Japan" => "Japan",
"Jersey & Guernsey" => "Jersey & Guernsey",
"Jordan" => "Jordan",
"Kazakhstan" => "Kazakhstan",
"Kenya" => "Kenya",
"Kiribati" => "Kiribati",
"Korea (North)" => "Korea (North)",
"Korea (South)" => "Korea (South)",
"Kuwait" => "Kuwait",
"Kyrgyzstan" => "Kyrgyzstan",
"Laos" => "Laos",
"Latvia" => "Latvia",
"Lebanon" => "Lebanon",
"Lesotho" => "Lesotho",
"Liberia" => "Liberia",
"Libya" => "Libya",
"Liechtenstein" => "Liechtenstein",
"Lithuania" => "Lithuania",
"Luxembourg" => "Luxembourg",
"Macau" => "Macau",
"Macedonia" => "Macedonia",
"Madagascar" => "Madagascar",
"Madeira" => "Madeira",
"Malawi" => "Malawi",
"Malaysia" => "Malaysia",
"Maldives" => "Maldives",
"Mali" => "Mali",
"Malta" => "Malta",
"Marshall Islands" => "Marshall Islands",
"Martinique" => "Martinique",
"Mauritania" => "Mauritania",
"Mauritius" => "Mauritius",
"Mayotte" => "Mayotte",
"Mexico" => "Mexico",
"Micronesia" => "Micronesia",
"Moldova" => "Moldova",
"Monaco" => "Monaco",
"Mongolia" => "Mongolia",
"Montenegro" => "Montenegro",
"Montserrat" => "Montserrat",
"Morocco" => "Morocco",
"Mozambique" => "Mozambique",
"Myanmar" => "Myanmar",
"Namibia" => "Namibia",
"Nauru" => "Nauru",
"Nepal" => "Nepal",
"Netherlands" => "Netherlands",
"Netherlands Antilles" => "Netherlands Antilles",
"Neutral Zone" => "Neutral Zone",
"New Caledonia" => "New Caledonia",
"New Zealand" => "New Zealand",
"Nicaragua" => "Nicaragua",
"Niger" => "Niger",
"Nigeria" => "Nigeria",
"Niue" => "Niue",
"Norfolk Island" => "Norfolk Island",
"Northern Mariana Islands" => "Northern Mariana Islands",
"Norway" => "Norway",
"Oman" => "Oman",
"Other" => "Other",
"Pakistan" => "Pakistan",
"Palau" => "Palau",
"Palestinian territories" => "Palestinian territories",
"Panama" => "Panama",
"Papua New Guinea" => "Papua New Guinea",
"Paraguay" => "Paraguay",
"Peru" => "Peru",
"Philippines" => "Philippines",
"Pitcairn" => "Pitcairn",
"Poland" => "Poland",
"Portugal" => "Portugal",
"Puerto Rico" => "Puerto Rico",
"Qatar" => "Qatar",
"Reunion" => "Reunion",
"Romania" => "Romania",
"Russian Federation" => "Russian Federation",
"Rwanda" => "Rwanda",
"Saint Kitts and Nevis" => "Saint Kitts and Nevis",
"Saint Lucia" => "Saint Lucia",
"Saint Vincent and the Grenadines" => "Saint Vincent and the Grenadines",
"Samoa" => "Samoa",
"San Marino" => "San Marino",
"Sao Tome and Principe" => "Sao Tome and Principe",
"Saudi Arabia" => "Saudi Arabia",
"Senegal" => "Senegal",
"Serbia" => "Serbia",
"Seychelles" => "Seychelles",
"Sierra Leone" => "Sierra Leone",
"Singapore" => "Singapore",
"Slovak Republic" => "Slovak Republic",
"Slovenia" => "Slovenia",
"Solomon Islands" => "Solomon Islands",
"Somalia" => "Somalia",
"South Africa" => "South Africa",
"Spain" => "Spain",
"Sri Lanka" => "Sri Lanka",
"St. Helena" => "St. Helena",
"St. Pierre and Miquelon" => "St. Pierre and Miquelon",
"Sudan" => "Sudan",
"Suriname" => "Suriname",
"Svalbard and Jan Mayen Islands" => "Svalbard and Jan Mayen Islands",
"Swaziland" => "Swaziland",
"Sweden" => "Sweden",
"Switzerland" => "Switzerland",
"Syria" => "Syria",
"Taiwan" => "Taiwan",
"Tajikistan" => "Tajikistan",
"Tanzania" => "Tanzania",
"Thailand" => "Thailand",
"Togo" => "Togo",
"Tokelau" => "Tokelau",
"Tonga" => "Tonga",
"Trinidad and Tobago" => "Trinidad and Tobago",
"Tunisia" => "Tunisia",
"Turkey" => "Turkey",
"Turkmenistan" => "Turkmenistan",
"Turks and Caicos Islands" => "Turks and Caicos Islands",
"Tuvalu" => "Tuvalu",
"Uganda" => "Uganda",
"Ukraine" => "Ukraine",
"United Arab Emirate" => "United Arab Emirate",
"United Kingdom" => "United Kingdom",
"United States" => "United States",
"Uruguay" => "Uruguay",
"US Minor Outlying Islands" => "US Minor Outlying Islands",
"USSR (former)" => "USSR (former)",
"Uzbekistan" => "Uzbekistan",
"Vanuatu" => "Vanuatu",
"Vatican City State (Holy See)" => "Vatican City State (Holy See)",
"Venezuela" => "Venezuela",
"Viet Nam" => "Viet Nam",
"Virgin Islands (British)" => "Virgin Islands (British)",
"Virgin Islands (U.S.)" => "Virgin Islands (U.S.)",
"Wallis and Futuna Islands" => "Wallis and Futuna Islands",
"Western Sahara" => "Western Sahara",
"Yemen" => "Yemen",
"Yugoslavia" => "Yugoslavia",
"Zambia" => "Zambia",
"Zimbabwe" => "Zimbabwe");
$options = "";
foreach($countries as $key => $value){
if($country=="$key"){
$options .= " \n";
}
else{
$options .= " \n";
}
}
return $options;
}
function fetch_url($url) {
# echo "244\n";
$ch = curl_init();
$timeout = 9999;
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Connection: Keep-Alive',
'Keep-Alive: 300'
));
$data = curl_exec($ch);
#curl_error($ch);
if (curl_errno($ch)) {
$info = curl_getinfo($ch);
$er = curl_errno($ch);
########################
## Try Again
########################
sleep(5);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
if (curl_errno($ch)) {
echo "\n Retry failed \n";
} else {
//echo "\n Retry Success\n";
}
}
curl_close($ch);
return $data;
}
function process_xml($raw_xml, $url = "") {
$raw_xml = trim($raw_xml);
$quotes = array(
'‘' => "'",
'’' => "'",
'“' => '"',
'”' => '"',
's' => 's',
'&' => "&"
);
$raw_xml = utf8_encode($raw_xml);
$raw_xml = str_replace(array_keys($quotes), $quotes, $raw_xml);
$raw_xml = utf8_for_xml($raw_xml);
#echo $raw_xml;
try {
$xml_result=new SimpleXMLElement($raw_xml) or die(error_get_last());
} catch (Exception $e) {
echo $raw_xml;
echo $e->getMessage();
echo "\n$url\n";
if ($url != "") {
$second_attempt = fetch_url($url);
$second_attempt = trim($second_attempt);
$second_attempt = utf8_encode($second_attempt);
$second_attempt = str_replace(array_keys($quotes), $quotes, $second_attempt);
$second_attempt = utf8_for_xml($second_attempt);
try {
$xml_result = new SimpleXMLElement($second_attempt);
} catch (Exception $e) {
echo "second parse attempt failed\n" . $second_attempt;
echo $e->getMessage();
echo "\n$url\n";
}
}
}
return $xml_result;
}
function utf8_for_xml($string) {
return preg_replace('/[^\x{0009}\x{000a}\x{000d}\x{0020}-\x{D7FF}\x{E000}-\x{FFFD}]+/u', ' ', $string);
}
function get_user_info($server, $siteID, $mlID, $password, $email){
$return_values = array();
$return_values["email"] = $email;
$type = "record";
$activity = "query-data";
$domain = "com";
$input = "
".$url."
";
$result = fetch_url($url);
}
if(isset($_POST['mlid'])){
update_user_profile($_POST['mlid'], $_POST['email'], $org_id, $password, $server);
#echo "Profile Updated!";
$mailing_list_id = $_POST['mlid'];
$email = $_POST['email'];
header("location: http://medicaleconomics.modernmedicine.com/");
exit();
}
else if(isset($_POST['cancel'])){
header("location: http://medicaleconomics.modernmedicine.com/");
exit();
}
?>