From aa93c170dbf6d429c02df4ed5ce82b9d45cebf64 Mon Sep 17 00:00:00 2001 From: james Date: Thu, 19 Oct 2006 22:54:26 +0000 Subject: [PATCH] Actually send the data to the YSF server! --- admin/cwsfregister.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/admin/cwsfregister.php b/admin/cwsfregister.php index 04a5b3c..5940e5b 100644 --- a/admin/cwsfregister.php +++ b/admin/cwsfregister.php @@ -179,7 +179,36 @@ function xmlCreateRecurse($d) mysql_query("UPDATE projects SET cwsfdivisionid='$d' WHERE id='$p'"); } echo happy(i18n("CWSF Project Divisions saved")); + } + if($_POST['action']=="register" && $_POST['xml']) + { + if(function_exists('curl_init')) + { + $ch = curl_init(); /// initialize a cURL session + curl_setopt ($ch, CURLOPT_URL,"https://secure.ysf-fsj.ca/registration/xmlregister.php"); + curl_setopt ($ch, CURLOPT_HEADER, 0); /// Header control + curl_setopt ($ch, CURLOPT_POST, 1); /// tell it to make a POST, not a GET + curl_setopt ($ch, CURLOPT_POSTFIELDS, "xml=".$_POST['xml']); /// put the query string here starting with "?" + curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); /// This allows the output to be set into a variable $datastream + curl_setopt ($ch, CURLOPT_POSTFIELDSIZE, 0); + curl_setopt ($ch, CURLOPT_TIMEOUT, 360); + curl_setopt ($ch, CURLOPT_SSLVERSION, 3); + $datastream = curl_exec ($ch); /// execute the curl session and return the output to a variable $datastream + $datastream = str_replace(" standalone=\"yes\"","",$datastream); + // echo "curl close
"; + curl_close ($ch); /// close the curl session + + echo i18n("The YSF Registration Server said:")."
"; + echo notice($datastream); + } + else + { + echo error("CURL Support Missing"); + echo i18n("Your PHP installation does not support CURL. You will need to login to the YSF system as the regional coodinator and upload the XML data manually"); + } + send_footer(); + exit; } $ok=true;