Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

webservice query

Participant ,
Oct 05, 2008 Oct 05, 2008
Hi, I Just Plyed around webservices and they are really
cool.

while I was doing work, I came across one Probel.

I was trying how to extract a random joke from a
website and give it a shape of a webservice,

I tried using the cfhttp tag but that fetched the whole
page.

Can Anyone guide how can I complete this Process.

The page i am trying to get IS:

http://www.ybored.com//index.php?
ACT=jksdisplay&jksid=1899

Cheers
TOPICS
Getting started
265
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 05, 2008 Oct 05, 2008
LATEST
This one's twice as much fun. I presume you know that a web service request is different from cfhttp.

When you make a cfhttp request you're actually playing the role of browser. That is why the whole page poured down on you. You have to do the filtering yourself.

Start by looking at the source code of the page in the browser. You will see that the author has made things easy for us. He or she has put the jokes in a table whose class attribute is "jokeContents". Neat. What you have to do is to treat the page content as a string, locate the table as a substring and extract it. The following code does just that.

Have fun. Oh, and, I liked the husband and wife one, where rupees change hands. Hilarious.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources