Dave, thanks for your help but I finally got it to work.  Just in case you are 
interested:

<!--------------------------------------------------------->
<!--- Expects URL.command                               --->
<!---       Export_Config                               --->
<!---       Import_Config Filename                      --->
<!---       Add_Collection CollectionID CollectionName? --->
<!---       Delete_Collection CollectionID              --->

<!--- Function to check HTTP response for errors and print debug --->
<cffunction name="checkHttpStruct" returnType="boolean">
 <cfargument name="httpStruct" type="Struct" required="yes">
 <cfargument name="stage" type="String" required="yes">

 <cfif LEN(httpStruct.errorDetail) GT 0>
  <cfdump var="#httpStruct.errorDetail#" label="#stage# Error"><BR>
  <cfreturn true>
 </cfif>
 <cfdump var="#httpStruct#" label="#stage# Response"><BR>
 <cfreturn false>
</cffunction>


<!--- Initialize --->
<cfset Variables.error = False>
<cfset Variables.googleWelcome = "Google Mini &gt; Home">
<cfset Variables.adminUser = "admin">
<cfset Variables.adminPwd = "blahblah">     <!--- TBD HARDCODE get from db --->
<cfset Variables.googleIP = "192.168.0.20"> <!--- TBD HARDCODE Application.cfm 
--->

<!--- Set the URL for the google admin console --->
<cfset Variables.url = "http://#Variables.googleIP#:8000/EnterpriseController";>

<!--- Send initial request to google.  This is just to get a response --->
<cfhttp method="GET" url="#Variables.url#" 
useragent="#CGI.HTTP_USER_AGENT#"></cfhttp>
<cfset Variables.error = checkHttpStruct(CFHTTP, "Initial Request")>

<cfif NOT Variables.error>
 <!--- Get the cookie from the response object. This is the cookie that --->
 <!--- we are going to echo back in subsequent CFHttp requests.         --->
 <!--- The google cookie will look like:  S=enterprise=XXXXXXXX;        --->
 <!---      where XXXXXXXX is a unique key                              --->
 <cfset Variables.googleCookie = 
   ListGetAt(CFHTTP.Response.ResponseHeader["Set-Cookie"],1,";")>

 <!--- Try to login --->
 <cfhttp method="POST" url="#Variables.url#" useragent="#CGI.HTTP_USER_AGENT#">
  <cfhttpparam name="#Variables.googleCookie#" type="COOKIE" 
value="#Variables.googleCookie#">
  <cfhttpparam name="actionType" type="URL"    value="authenticateUser">
  <cfhttpparam name="userName"   type="URL"    value="#Variables.adminUser#">
  <cfhttpparam name="password"   type="URL"    value="#Variables.adminPwd#">
 </cfhttp>
 <cfset Variables.error = checkHttpStruct(CFHTTP, "Login Request")>
</cfif>

<cfif NOT Variables.error>
 <!--- Check if we have a successful login by looking for the google welcome on 
the admin main page --->
 <cfif FindNoCase("#Variables.googleWelcome#", CFHTTP.Filecontent) EQ 0>
  <cfoutput>Login Failed</cfoutput><BR>
  <cfset Variables.error = True>
 </cfif>
</cfif>

<cfif NOT Variables.error>
 <cfoutput>Login Success</cfoutput><BR>
 <cfif URL.command EQ "Export_Config">
  <!--- Export Config --->
  <cfhttp  method="POST" url="#Variables.url#" 
useragent="#CGI.HTTP_USER_AGENT#">
   <cfhttpparam name="#Variables.googleCookie#" type="COOKIE" 
value="#Variables.googleCookie#">
   <cfhttpparam name="actionType" type="URL"    value="importExport">
   <cfhttpparam name="export"     type="URL"    value="Export Configuration">
   <cfhttpparam name="password1"  type="URL"    value="#Variables.adminPwd#">
   <cfhttpparam name="password2"  type="URL"    value="#Variables.adminPwd#">
  </cfhttp>
 <!--- TBD
 <cfelseif URL.command EQ "Import_Config">
 <cfelseif URL.command EQ "Add_Collection">
 <cfelseif URL.command EQ "Delete_Collection">
 <cfelse>
 TBD --->
 </cfif>
 <cfset Variables.error = checkHttpStruct(CFHTTP, "#URL.command#")>

 <!--- Log out --->
 <cfhttp method="POST" url="#Variables.url#" useragent="#CGI.HTTP_USER_AGENT#">
  <cfhttpparam name="#Variables.googleCookie#" type="COOKIE" 
value="#Variables.googleCookie#">
  <cfhttpparam name="actionType"               type="URL"    value="logout">
 </cfhttp>
 <cfset Variables.error = checkHttpStruct(CFHTTP, "Logout Request")>
</cfif> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311759
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to