Tally List : mailing list management, archiving, and analysis
click for archive home
 
Archive of:
CF-Talk
Cold Fusion - Technical
 
home
24 hour view
quick stats
weekly updates
 
all tallylists
corporate solutions
archive your favorite
help / feedback


Search the Tallylist search by keyword:

About Cold Fusion :
product's home
product's list home
 
  Archived TallyList / CF-Talk: 
Subject: RE: Parsing??
Craig Thomas (10p/+0r)     Posted: Saturday 16 Dec 2000
This post: 99 views, +0 rating

Do you have access to the code of the target page?

All my <cfset> tags and the find() and len() functions add and subtract characters from the CFHTTP.FileContent variable...giving me parts of the web page I want to display. Watch out, if the target page changes, your code needs to change.

In my code the "Start" variable is where I start, the "Stop" is where I stop and the "Headline" is that part of the page I want to display.

Craig

-----Original Message----- From: ibtoad [mailto:ibtoad@punkass.com] Sent: Saturday, December 16, 2000 12:18 PM To: CF-Talk Subject: RE: Parsing??

I have successfully used the cfhttp tag to pull a webpage and then display it with CFHTTP.FileContent. But how do I just display specific parts?

Rich

-----Original Message----- From: Craig Thomas [mailto:craig@pkinteractive.com] Sent: Saturday, December 16, 2000 11:10 AM To: CF-Talk Subject: RE: Parsing??

Rich,

To parse a web page you first grab the content with the <CFHTTP> tag, then "read" the content using the CFHTTP.FileContent variable. In the code below I use the find and len functions to figure out where to start and stop the reading/parsing of the page.

This code works only when the page you are parsing is set up just like the code. Where to start and stop depends on what piece of what page you are trying to parse...if you want the entire page, it lives in the CFHTTP.FileContent variable returned by the <CFHTTP> call. The online help in CF Studio is worth a read to understand the <CFHTTP> tag.

<!---get news item for today from somewebsite.com--->

<cfset TodayIS = DateFormat(Now(), 'dddd')>

<cfset YesterDayWas = dateFormat(Now(), 'd')-5> <cfset YesterDayWas = dateFormat(YesterDayWas, 'dddd')>

<cfhttp method="get" url="http://www.somewebsite.com" resolveurl="Yes">

<cfset Start = find("#TodayIS#", cfhttp.FileContent)>

<cfset Headline = Right(CFHTTP.FileContent, (len(CFHTTP.FileContent)-Start)-23)>

<cfset Stop = Find("#YesterDayWas#", Headline)>

<cfset Headline = Left(Headline, Stop-20)>

Craig,

PK Interactive Inc. NY, NY 10001 212.273.9623

-----Original Message----- From: ibtoad [mailto:ibtoad@punkass.com] Sent: Saturday, December 16, 2000 10:48 AM To: CF-Talk Subject: Parsing??

Can anyone tell me where I can find out how to parse a webpage and pull out specific information? I have never done this before.

Thanks, Rich


Similar Subject Line Posts (+/- two weeks of this post)
RE: Parsing??  18 Dec 2000   (118 v/ +0 r)
RE: Parsing??  18 Dec 2000   (99 v/ +0 r)
RE: Parsing??  16 Dec 2000   (92 v/ +0 r)
Re: Parsing??  16 Dec 2000   (95 v/ +0 r)
Re: Parsing??  16 Dec 2000   (113 v/ +0 r)
Re: Parsing??  16 Dec 2000   (258 v/ +1 r)
RE: Parsing??  16 Dec 2000   (91 v/ +0 r)
RE: Parsing??  16 Dec 2000 (this post)   (99 v/ +0 r)
RE: Parsing??  16 Dec 2000   (100 v/ +0 r)
RE: Parsing??  16 Dec 2000   (92 v/ +0 r)
Parsing??  16 Dec 2000   (99 v/ +0 r)
 

Send a reply to the CF-Talk list!
click to send a reply! NOTE: Many lists will reject your post unless you have already registered with them. Also - don't forget the right account to send from (for those with multiple emails!)

Feedback: If this post was exceptionally helpful, please help by giving this post a positive review.

 

TallyList : copyright Ububik - 2000