User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ColdFusion section within the Web Development category of DaniWeb, a massive community of 456,565 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,577 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ColdFusion advertiser: Programming Forums
Views: 1660 | Replies: 1
Reply
Join Date: Sep 2007
Posts: 6
Reputation: becraig is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
becraig becraig is offline Offline
Newbie Poster

CFHTTP CFLOOP and unique variable

  #1  
Oct 24th, 2007
ok I am kinda dumb so let me try to make sense

I am trying to do the following
1) I want to read an html file (Done invoked CFHTTP)
2) find a value in the file which is embedded between a <li>eg <li class=class>Value I am looking for </li> (Think I kinda got this part.
3) Now this is where it gets difficult for me, there are at any given time a random number of values between the <li> </li> I may have 12 <li> </li> today and 5 tmrw etc

I want to be able to read those values assign them a specific value then pass them to a file

eg:

<CFHTTP URL='http://127.0.0.1/file.htm' METHOD='GET' RESOLVEURL='yes'></CFHTTP>
<cfset start = FindNoCase('<li class=class>' , cfhttp.FileContent)+9>
<cfset strLength= FindNoCase('</li>' , cfhttp.FileContent)-start>
<cfset value = mid(cfhttp.FileContent,start,strLength)>


The problem is I want to be able to repeat that step and to have a unique value for each new instance where a value is found between the <li> and </li>


please help me guys.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jan 2008
Posts: 3
Reputation: l14n is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
l14n l14n is offline Offline
Newbie Poster

Solution Re: CFHTTP CFLOOP and unique variable

  #2  
Jan 24th, 2008
Hi

Reply if this code is of any use for you.

<cfset test_data = "string variable having li tags">

<cfset test_data = Replace(test_data, "<li class=class>", "$@*","all")>
<cfset test_data = Replace(test_data, "</li>", "$@*","all")>

<cfloop list="#test_data#" delimiters="$@*$@*" index="item">
<cfoutput>#item#</cfoutput><br />
</cfloop>
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ColdFusion Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the ColdFusion Forum

All times are GMT -4. The time now is 5:51 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC