This looks very helpful Jeremy - Thanks!
What does your <cf_hmac> custom tag look like? Thanks, Clarke From: ad...@acfug.org [mailto:ad...@acfug.org] On Behalf Of Jeremy Bruck Sent: Thursday, July 29, 2010 5:07 PM To: discussion@acfug.org Subject: Re: [ACFUG Discuss] URL Encoding Question Clark, I do remember battling this one for a little while one day -- granted I am using Railo but it should work no problem in Adobe CF as well. Here is the code from my CFC which pulls data from Amazon's Alexa: You will also notice I am using a hash function custom tag which Amazon wants as well. You would want to put your key and secret key in below... <cfset var digest = ""> <cfset var signature = ""> <cfset var amazon = ""> <cfset var actionName = "UrlInfo"> <cfset var key="xxxxxxxxxxxxxx"> <cfset var secretkey="xxxxxxxxxxxxx"> <cfset var dateTimeString = GetHTTPTimeString(Now())> <cfset setTimezone("Etc/GMT+0")> <cfset var Timestamp = DateFormat(dateTimeString, "yyyy-mm-dd") & "T" & lsTimeFormat(dateTimeString, "HH:mm:ss") & ".000Z"> <cf_hmac data="#actionName##Timestamp#" key="#secretkey#" hash_function="sha1" > <cfset signature = ToBase64(Binarydecode("#digest#","hex"))> <cfset var AmazonURL = "http://awis.amazonaws.com/?AWSAccessKeyId=#key# <http://awis.amazonaws.com/?AWSAccessKeyId=#key#&Timestamp=#URLEncodedFormat (timestamp)#&Signature=#signature#&Version=2005-07-11&Action=#actionName#&Re sponseGroup=RankByCity,TrafficData,OwnedDomains,LinksInCount&Url=#arguments. siteURL#> &Timestamp=#URLEncodedFormat(timestamp)#&Signature=#signature#&Version=2005- 07-11&Action=#actionName#&ResponseGroup=RankByCity,TrafficData,OwnedDomains, LinksInCount&Url=#arguments.siteURL#"> <cfhttp method="get" url="#AmazonURL#" result="amazon"> <cfhttpparam type="Header" name="TE" value="deflate;q=0"> <cfhttpparam type="header" name="Accept-Encoding" value="*" /> <cfhttpparam type="header" name="Accept" value="text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/p lain;q=0.8,image/png,*/*;q=0.5"> <cfhttpparam type="header" name="Accept-Language" value="en-us,en;q=0.5"> </cfhttp> Regards, Jeremy ------------------------------------------ Strategic Growth Services, LLC Jeremy Bruck jbr...@growstrategy.com 770-953-8643 x103 770-916-1434: fax On Jul 29, 2010, at 4:58 PM, Clarke Bishop wrote: I have a date string like this 2010-07-29T20:45:33.517Z that I am trying to submit to Amazon's web service. It needs to be URL Encoded, so I am submitting with this code: <cfhttpparam type="URL" name="Timestamp" value='#Timestamp#'> Coldfusion 8 encodes this to: 2010%2D07%2D29T20%3A45%3A33%2E517Z But when I submit the same string via http://www.w3schools.com/TAGS/ref_urlencode.asp I sends back 2010-07-29T20%3A45%3A33.517Z So ColdFusion is encoding the "." and the "-", but W3C isn't. These are actually both valid in a URL. Of course, both correct encode the ":". I wouldn't care except the Amazon web service is throwing an error saying I need to use a valid ISO 8601 date. Has anyone run into a problem like this before? Is there a trick? Thank, Clarke Office: 770-642-1353 eMail: cbis...@resultantsys.com ------------------------------------------------------------- To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by FusionLink <http://www.fusionlink.com> ------------------------------------------------------------- ------------------------------------------------------------- To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com -------------------------------------------------------------