• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Chttp receiving page breaking the variable

New Here ,
Jan 30, 2011 Jan 30, 2011

Copy link to clipboard

Copied

I have a program doing a cfhttp get to a url with two variables: a file name and an id. The id is being sent correctly. 1234556. However, once it gets to the receiving page and I do an output of that value to check it, it shows up as 1 2 3 4 5 6.  While I can do a replace on that end for the spaces, the file name generation that includes that id then breaks as well. I'm using Colfusion 5.0..

An example:

<cfset appid = "1234565">

<cfset appfile = "abc_" + #appid#>

<cfhttp url="index.cfm?appfile=#appfile#&appid=#appid#" timeout=5>

A write to file from the index.cfm page to show both variables shows as this:

abc_1 2 3 4 5 6 1 2 3 4 5 6

It also shows a special character.. not sure if it's a line break or not.. it's a little square next to the appid.

Any ideas would be appreciated.

Thanks!

TOPICS
Advanced techniques

Views

483

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 31, 2011 Jan 31, 2011

Copy link to clipboard

Copied

I'm surprised it actually runs given that you are not using the correct concatonation operator.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 31, 2011 Jan 31, 2011

Copy link to clipboard

Copied

Ahhh.. so it seems. That was a mistype on my part... I had the code at work, and am still getting used to Coldfusion after not working with it for a while.

Here is the actual code:


<cffile action="read" file="/code/iplanet/docs/info.txt" variable="filecontent">
               <cfloop index="index" list="#filecontent#" delimiters="|">
               <cfset appfile = "info" & "_"
          & index & "_"
          & numberformat(year(now()),"0009")
          & numberformat(month(now()),"09")
          & numberformat(day(now()),"09")
          & "_"
          & numberformat(hour(now()),"09")
          & numberformat(minute(now()), "09")
          & numberformat(second(now()) ,"09")
          & "_"
          & randrange(1000,9999)>


          <cfhttp url = "http://fullurl/process.cfm?appfile=#appfile#&appid=#index#" method="get" timeout=5>

Process.cfm page:

I currently do this to fix the spaces in the appid
<cfset client.appid = Replace(url.appid," ","","all")>

The rest is the same.. extra spaces, special character after the last number of the appid

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 01, 2011 Feb 01, 2011

Copy link to clipboard

Copied

What happens if you use hard coded values instead of variables in the url string?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 01, 2011 Feb 01, 2011

Copy link to clipboard

Copied

If I hard code the values being sent, it is sent correctly with no extra spaces. So it works fine that way.. just not with the variables

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 01, 2011 Feb 01, 2011

Copy link to clipboard

Copied

LATEST

So the next step is to identify the point at which your variables misbehave.  What happens if you cfdump them after they are created?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation