> I have an app. where when a user logs in, it goes out and fetches
> user preferences, news, weather etc. Calls to news/weather are
> CFHTTP, and the intention is to send the location_id of the user
> to the weather module and it sends the weather based on that id.
> When the user logs in, the app sets client vars including that
> of location etc so they are available for that client. Now when
> I fetch the weather, the template that processes weather gives an
> error saying client.location_id does not exist. I also tried
> with session variables, still it didn't work. Since both the
> calling templates and the called templates reside on the same
> server, I then tried calling it by the CFINCLUDE tag, which then
> understandably remembers the client and session variables. However
> the problem with cfinclude is that I can't resolve the links within
> the called template accurately and they get all messed up. Another
> thing I tried is to send the client vars thru the URL( the urls are
> stored in a database) e.g. <cfhttp method=get url=#object_url#> where
> object_url comes from the database and is of the form
> http://blah.com/weather.cfm?location_id=#client.location_id#>.
> Problem with this is that the url parameter that I m trying to send
> doesn't get processed. Aghhhhh! and it just writes the word
> "client.location_id" as a text string.
>
> I would really appreciate any help. Preferably I'd like to use the
> cfhttp method and somehow be able to send parameters with it.

When you use CFHTTP, you're using CF as if it were a regular web browser
talking to a web server. When you use a browser to request a CF script which
uses Client or Session variables, that script sends a token to the browser,
usually a cookie or two but potentially a URL parameter, which is returned
by the browser with each subsequent request and then used on the server to
associate that specific request with the Client or Session variables in
question. So, when you use CFHTTP to request a CF script, whether it's on
your server or another, and that script uses Client or Session variables,
you'll be responsible for sending the identifying token back to the server.
If the server is setting cookies for the token, you'll have to read those
cookies, contained within the HTTP response header, and return them with any
subsequent request. You can read the HTTP response header after your initial
CFHTTP request in CF 4.5.x using the variables CFHTTP.Header and/or
CFHTTP.ResponseHeader. If you're using an older version of CFHTTP, you won't
be able to read the cookies. There are third-party HTTP components available
which will let you read the headers, though.

So, you can do what you're trying to do, but in any case you'd be better off
not using CFHTTP at all. Using CFHTTP is a lot of work to move data from one
script or application to another. You'd be much better off writing a script
that just gets the data directly.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to