Skip to main content
Participating Frequently
March 22, 2007
Question

Parsing variable values!!! Please help

  • March 22, 2007
  • 2 replies
  • 256 views
This is something I've been doing for many many years (parsing web content with permission of the company), I CFHTTP an entire web page off their website. Then I parse out the stuff I don't want like the HTML tags etc. and I keep the rest of the data and populate on my page.

So far I used <cfset gfile="replacenocase('the text I want to parse','')"

But that only works well on defined text... What happened recently is the web page I target was recently added with other field that are variable and looks typically like this:

<a href='TourID= 4462&DepartureDate= 7/13/2007'>Click</a>',''

The bold values are different on every line and there are hundreds of lines on each page. I would want to parse it all out. But how do I tell CF through a <CF SET=> to remove those lines regardless of what the variable values are.
    This topic has been closed for replies.

    2 replies

    Inspiring
    March 22, 2007
    So you want to replace that text? sounds like a job for regular expressions. Unfortunately, I'm on my way out right now, but I would look up the reReplaceNoCase() function and regular expressions.

    Inspiring
    March 22, 2007
    What do you mean you want to parse them all out - do you want to remove them or save them to a variable.

    A better question might be - do you have permission to be screen scraping this website? A lot of sites might not look to kindly on the sort of processing you are doing without explicit permission from the owner of the code in question.
    gflex22Author
    Participating Frequently
    March 22, 2007
    As you can see in my first post the CFSET example, I save it all to a variable so I could output the values on my site.

    This website is my wholesale supplier, and they welcome me using the data for the purpose of selling.