ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 11th, 2005, 08:39 AM
samb1 samb1 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 67 samb1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 42 m 42 sec
Reputation Power: 5
Performing a cfhttp on a returned string??

Im trying to perform a cfhttp on a string, which in this case is: #xmlObj.xmlRoot.site[i].xmlAttributes.index# and it contains a URL, but Im unsure how to do this in the loop. I have tried:
<cfhttp method="get" URL="#xmlObj.xmlRoot.site[i].xmlAttributes.index#" ResolveURL="yes"></cfhttp> but this does not work .
How can I achieve this?
Here is my code:

<cfhttp method="get" URL="http://localhost:8500/Project/template.xml" ResolveURL="yes"></cfhttp>

<cfset xmlString = cfhttp.fileContent />

<cfset xmlObj = xmlParse( xmlString ) />

<cfoutput>
<cfloop from="1" to="#arrayLen( xmlObj.xmlRoot.xmlChildren )#" index="i">
<p>
#xmlObj.xmlRoot.site[i].xmlAttributes.index#<br />
#xmlObj.xmlRoot.site[i].parse[1].xmlAttributes.re#
<!---#xmlObj.xmlRoot.site[i].parse["detail-page-parsers"].xmlAttributes.re#</p>--->
</cfloop>
</cfoutput>

Reply With Quote
  #2  
Old March 11th, 2005, 08:52 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,682 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 25 m 55 sec
Reputation Power: 53
First you don't need to use matching tags for CFHTTP unless you're including child tags like CFHTTPPARAM. Do this:

<cfhttp method="get" URL="#xmlObj.xmlRoot.site[i].xmlAttributes.index#" ResolveURL="yes" />

Beyond that I can't tell what you are asking for. What is the acutal problem? Is the CFHTTP call generating an error? If the problem is that you're getting back XML and you aren't sure how to loop over it, just dump it <cfdump var="#xmlObj#">
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old March 11th, 2005, 09:04 AM
samb1 samb1 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 67 samb1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 42 m 42 sec
Reputation Power: 5
Kiteless,
I have made changes to the code I listed previously. However the problem is my output is the string URL with the message "connection failure" displayed underneath it.
Here is my code:



<cfset xmlString = cfhttp.fileContent />

<cfset xmlObj = xmlParse( xmlString ) />

<cfoutput>
<cfloop from="1" to="#arrayLen( xmlObj.xmlRoot.xmlChildren )#" index="i">
<p>
#xmlObj.xmlRoot.site[i].xmlAttributes.index#<br />
<cfhttp method="get" URL="xmlObj.xmlRoot.site[i].xmlAttributes.index" ResolveURL="yes">
#cfhttp.FileContent#
parsers"].xmlAttributes.re#</p>--->
</cfloop>
</cfoutput>

Reply With Quote
  #4  
Old March 11th, 2005, 09:26 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,682 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 25 m 55 sec
Reputation Power: 53
Can you take each of those URLs and manually use them in a CFHTTP call? Do they work then? You could try using trim() to trim any extra whitespace around the variable holding the URL.

Reply With Quote
  #5  
Old March 11th, 2005, 09:49 AM
samb1 samb1 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 67 samb1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 42 m 42 sec
Reputation Power: 5
Ive done manual cfhttp requests on all three sites and they all return the pages without problems.
Ive used Trim in the cfhttp request:
<cfhttp method="get" URL="Trim(xmlObj.xmlRoot.site[i].xmlAttributes.index)" ResolveURL="yes">
Is this the correct syntax? It still returned a "connection failure" for all three.
Could it be down to the fact that I am cfhttp'ing all three sites in the loop?

Reply With Quote
  #6  
Old March 11th, 2005, 10:10 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,682 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 25 m 55 sec
Reputation Power: 53
Are you forgetting the pound signs?

<cfhttp method="get" URL="#Trim(xmlObj.xmlRoot.site[i].xmlAttributes.index)#" ResolveURL="yes">

Reply With Quote
  #7  
Old March 11th, 2005, 10:13 AM
samb1 samb1 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 67 samb1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 42 m 42 sec
Reputation Power: 5
Indeed I am. Problem solved. Much appreciated

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Performing a cfhttp on a returned string??


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT