We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi All,
I'm trying to retrieve some quotes from this page with not much luck. https://www.brainyquote.com/quotes/topics/topic_knowledge.html
I've tried both loadStringI() and loadXml(), what other options do I have?
Thanks, Charles
Answers
Try this website: http://forismatic.com/en/api/
There is a tester interface: http://api.forismatic.com/api/tester/ Fill the following:
Or paste this in your browser: http://api.forismatic.com/api/1.0/POST?method=getQuote&key=train&format=json&lang=en
You get the following which can be processed by using JSON calls (See reference):
@shiffman might like this for his API series.
Kf
I get a NullPointer on the loadJSONObject():
ps: ignore the href, it's the processing forum formatting
Defeat the forum URL mangling by splitting URL strings in two:
@CharlesDesign
I am sure it will work in p5.js but my experience in processing accessing APIs is limited. I will need to do further testing myself. As an alternative, try using a standard GET/POST via HTTP request and format html (you can browse previous posts in the forum, keyword POST). Alternatively, try any of the other formats: I will start with xml and use loadXML (?) or text and loadStrings?
I am not able to try atm.
Kf
@CharlesDesign
From this post:
https://forum.processing.org/two/discussion/22202/http-request/p1
If you want to work with json, do the following (change the post format to json):
Working with xml:
Kf
Perfect, thanks kfrajer!