Tally List : mailing list management, archiving, and analysis
click for archive home
 
Archive of:
CFtipsPlus
Cold Fusion tips email (external)
 
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 Tips :
product's home
product's list home
 
  Archived TallyList / CFtipsPlus: 
Subject: customized Word docments | <CFHTTP>: Seize data from the web!
Nathan Stanford (23p/+0r)     Posted: Sunday 25 Feb 2001
This post: 173 views, +0 rating

============== ColdFusion TIPS PLUS ColdFusion 01 Volume 01 Issue 08 =============================================================== http://www.cftipsplus.com ============== Issue 00047 ============== I. Comments: II. Returning customized Word docments in CF By Michael Smith http://www.teratech.com/ColdCuts/cutdetail.cfm?cutid=66

III. <CFHTTP>: Seize data from the web! By Ian Smith ians@inker.com ==============

============== I. Comments:

If you would like to write for cftipsplus.com send us an email to:

admin@cftipsplus.com

We are looking for a few new writers. We have been providing tips for more then a year now and we are expecting to grow.

=============================================================== If you have any suggestions please email me at cftips@nsnd.com. ===============================================================

=============================================================== II. Returning customized Word docments in CF By Michael Smith http://www.teratech.com/ColdCuts/cutdetail.cfm?cutid=66 ===============================================================

In the CF program

<A HREF="custdetail.cfm?#cgi.QUERY_STRING#&WordLetter=Y"> <IMG ALIGN="top" BORDER="0" SRC="/images/word.gif" Alt ="Write Letter">Write Letter</A>

<cfif isdefined("WordLetter")> <CFCONTENT TYPE="application/rtf"> <cfinclude template="CustomerLetter.rtf"> </cfif>

Inside the *WORD* doc I saved the file as RTF format and put the following CF code inside all my Word font etc formating:

<CFOUTPUT QUERY="GetDetail"> <CFIF isdefined("dinfono")> Infono #dinfono#</cfif> <CFIF isdefined("dcustno")> Custno #dcustno#</cfif> #trim(sfnam)# #trim(slnam)#<cfif scomp is not ""> #trim(scomp)# </cfif>#trim(sadd1)# #trim(sadd2)# #trim(scity)# #trim(sst)# #trim(szip)# #trim(scountry)# Tel: #trim(swork)# Fax: #trim(faxnmbr)# Email: #trim(email)# </CFOUTPUT>

===============================================================

============== III. <CFHTTP>: Seize data from the web! By Ian Smith ians@inker.com ==============

If you're dealing with documents you don't currently host, the tool to use is <CFHTTP>. This tag allows you to easily connect with another server, retrieve a file, and save the contents of that file as a variable. Syntax: <CFHTTP URL="http://yahoo.com"; METHOD="GET" RESOLVEURL="YES"> Now you can output the page using the variable #CFHTTP.FileContent#. However, you will likely need cold hard data from the page; meaning you must ditch the formatting and navigational code. Like eating the turkey and spitting out the bones, you have to break the information you want out of the page's HTML source. By setting Beginning and Ending markers, you can define where the data you want appears on the page. Then, using the Mid function, you can seize the data and save it to a variable. Bits of HTML code or odd words work nicely as markers; but, I recommend checking to make sure the page contains only one instance of your defined marker.

Syntax: <CFSET BeginTitle = "<title>"> <CFSET EndTitle = "</title>"> <CFSET StartTitle = Find(BeginTitle,CFHTTP.FileContent) + 7> <CFSET StopTitle = Find(EndTitle,CFHTTP.FileContent,StartTitle)> <CFSET Yahoo_Title = Mid(CFHTTP.FileContent,StartTitle,StopTitle-StartTitle)> Now, as you can probably see, we have selected the data found between the Title tags of Yahoo's main page. One word: Yahoo! Was that a waste of time? Not at all. Remember you still have the rest of Yahoo's page in a variable. With a few modifications you can retrieve a list of categories or news headlines from the same source code. Try useing different markers to find different information. Add a <CFLOOP> to grab the individual items in a bullet list. Or try an Array to save your data for output later. Remember though, taking information from other websites often violates copyright laws. Make sure the website condones this type of activity before you do anything rash, and it is always best to contact the webmaster if you are going to be posting your creation for public consumption.

============== Publisher and Creator: Nathan Stanford, admin@cftipsplus.com

Web Developers: Dain Anderson, danderson@cftipsplus.com Hal Helms, hal.helms@TeamAllaire.com Ian Smith, ians@inker.com Kevin Schmidt, schmidt@pwb.com Scott Knaub, scott@web-mgt.com Vincent Egt, vincent@e-dynamics.nl

============== Copyright (c) 2000 - 2001 CFTIPSPLUS.COM and NSND.COM Permission is granted to circulate this publication via MANUAL forwarding by email to friends provided that the text is forwarded in its entirety and no fee is charged. ==============

============== To unsubscribe: unsubscribe-cftips@nsnd.com

To subscribe: subscribe-cftips@nsnd.com ==============

____________________________________________________________ T O P I C A -- Learn More. Surf Less. Newsletters, Tips and Discussions on Topics You Choose. http://www.topica.com/partner/tag01


Similar Subject Line Posts (+/- two weeks of this post)
customized Word docments | <CFHTTP>: Seize data from the web!  25 Feb 2001 (this post)   (173 v/ +0 r)
customized Word docments | <CFHTTP>: Seize data from the web!  25 Feb 2001   (173 v/ +0 r)
 

Send a reply to the CFtipsPlus 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