> 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
Craig already showed you one method.
Basic info is that cfhttp.filecontent is one_big_string.
You use the various cf string functions to extract
what you want from one_big_string.
Regular expressions help a lot (see function list
in docs).
When you grab a web page's content with cfhttp
all the content is stored in the variable cfhttp.filecontent.
If you need to extract more than one item from
one_big_string, you might want to copy one_big_string
to additional variables - one variable for each extraction.
That keeps you from having to refresh cfhttp.filecontent.
Thus,
<cfset tmp1=cfhttp.filecontent>
..... do extractions
..... ending with content_1 you want to use
<cfset tmp2=cfhttp.filecontent>
.... do extractions
..... ending with cntent_2 you want to use
repeat
The simplest extraction method is using the
mid() function. If the web page is static,
never changes and you count the char positions
to set the attritbutes of mid(), then you need to
do nothing more.
A little more complex is using Find() to set
the beginning and end values of mid(). If the
web page is dynamic, but the info you want
always begins with a specific char sequence
and ends with a specific char sequence, then
you can use Find() or FindNoCase() to determine
where to begin and end your mid() extraction.
In some cases you can use the suite of
List functions to do your extractions.
In particular when the cfhttp.filecontent is
a collection of well formed sentences you
can use chr(32),chr(10),chr(13) as a list
delimiters and go from there. I would classify
this as a technique for a special case.
Better methods involve using regular expression
via the REFind(),REFindNoCase(),REReplace(),
and REReplaceNoCase() functions along with
several other string manipulation functions
and techniques.
Beyond string manipulation wddx and xml
can be your solution.
Beyond common packet formation and
trasmission formats (like xml, wddx)
there is AI based pattern recognition
and cognitive artificial ideation, but
for all practical purposes this amounts
to nothing more than employing an
esp() function :) .
Pan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists