{"id":748,"date":"2016-12-25T15:20:39","date_gmt":"2016-12-25T15:20:39","guid":{"rendered":"http:\/\/intelligentonlinetools.com\/blog\/?p=748"},"modified":"2016-12-26T14:37:47","modified_gmt":"2016-12-26T14:37:47","slug":"quotes-api-for-web-designers-and-developers","status":"publish","type":"post","link":"http:\/\/intelligentonlinetools.com\/blog\/2016\/12\/25\/quotes-api-for-web-designers-and-developers\/","title":{"rendered":"Quotes API for Web Designers and Developers"},"content":{"rendered":"<p>No one can deny the power of a good quote. They motivate and inspire us to be our best. [1]<\/p>\n<p>Here are 3 quotes API that can be integrated in your website with source code example in perl.<\/p>\n<p>1. <a href=https:\/\/market.mashape.com\/andruxnet\/random-famous-quotes target=\"_blank\">Random Famous Quotes<\/a> provides a random quote from famous movies in JSON format. This API is hosted on Mashape.<br \/>\nMashape has example how to use API with unirest.post module however as perl is not supported by unirest here is the example of consuming API in different way. You need obtain Mashape key to run your own code.<\/p>\n<pre><code>\r\n#!\/usr\/bin\/perl\r\nprint \"Content-type: text\/html\\n\\n\";\r\nuse LWP::UserAgent;\r\nuse HTTP::Request::Common qw{ POST };\r\nuse JSON qw( decode_json );\r\n\r\nmy $ua = LWP::UserAgent->new;\r\n\r\n$server_endpoint=\"https:\/\/andruxnet-random-famous-quotes.p.mashape.com\/?cat=movies\";\r\nmy $req = HTTP::Request->new(POST => $server_endpoint);   \r\n\r\n$req->header('content-type' => 'application\/x-www-form-urlencoded');\r\n$req->header('X-Mashape-Key' => 'xxxxxxxxxxxxx');\r\n$req->header('Accept' => 'application\/json');\r\n\r\n$req->content($post_data);\r\n\r\n$resp = $ua->request($req);\r\nif ($resp->is_success) {\r\n    \r\n     my $message = decode_json($resp->content);\r\n\r\nprint $message->{\"quote\"};\r\nprint $message->{\"author\"};\r\n\r\n}\r\nelse {\r\n    print \"HTTP GET error code: \", $resp->code, \"\\n\";\r\n    print \"HTTP GET error message: \", $resp->message, \"\\n\";\r\n}\r\n\r\n<\/code><\/pre>\n<p>2.  <a href=http:\/\/forismatic.com\/en\/ target=\"_blank\">Forismatic.com<\/a> provides API to collection of the most inspiring expressions of mankind. The output is supported different formats such as xml, json, jsonp, html,<br \/>\ntext. The quotes can be in English or Russian language. Below is the source code example how to consume this API. Note that in this example we use method GET while in previous example we used method POST. Also the code example is showing how to get output in json and html formats.<\/p>\n<pre><code>\r\n\r\n#!\/usr\/bin\/perl\r\nprint \"Content-type: text\/html\\n\\n\";\r\nuse LWP::UserAgent;\r\nuse HTTP::Request::Common qw{ POST };\r\nuse JSON qw( decode_json );\r\n\r\n\r\nmy $ua5 = LWP::UserAgent->new;\r\n\r\nmy $req5 = HTTP::Request->new(GET => \"http:\/\/api.forismatic.com\/api\/1.0\/?method=getQuote&format=json&lang=en\");\r\n\r\n$req5->header('content-type' => 'application\/json');\r\n$resp5 = $ua5->request($req5);\r\n\r\nif ($resp5->is_success) {\r\n          \r\n     $message = decode_json($resp5->content);\r\n     \r\n\r\nprint $message->{\"quoteText\"};\r\nprint $message->{\"quoteAuthor\"};\r\n\r\n}\r\nelse {\r\n    print \"HTTP GET error code: \", $resp->code, \"\\n\";\r\n    print \"HTTP GET error message: \", $resp->message, \"\\n\";\r\n}\r\n\r\n# below is the code to get output in html format\r\nmy $req5 = HTTP::Request->new(GET => \"http:\/\/api.forismatic.com\/api\/1.0\/?method=getQuote&format=html&lang=en\");\r\n\r\n     $req5->header('content-type' => 'text\/html');\r\n\r\n     $resp5 = $ua5->request($req5);\r\n     if ($resp5->is_success) {\r\n    \r\n     $message5 = $resp5->content;\r\n     print $message5;\r\n  }\r\nelse {\r\n    print \"HTTP GET error code: \", $resp->code, \"\\n\";\r\n    print \"HTTP GET error message: \", $resp->message, \"\\n\";\r\n}\r\n\r\n<\/code><\/pre>\n<p>3. <a href=https:\/\/favqs.com\/ target=\"_blank\">favqs.com<\/a> also provides quotes API. You can do many different things with quotes on this site on with API.  FavQs allows you to collect, discover, and share your favorite quotes. You can get quote of the day, search by authors, tags or users. Here is the code example<\/p>\n<pre><code>\r\n#!\/usr\/bin\/perl\r\nprint \"Content-type: text\/html\\n\\n\";\r\nuse LWP::UserAgent;\r\nuse HTTP::Request::Common qw{ POST };\r\nuse JSON qw( decode_json );\r\n\r\n    my $req5 = HTTP::Request->new(GET => \"https:\/\/favqs.com\/api\/qotd\");\r\n\r\n     $req5->header('content-type' => 'application\/json');\r\n     $resp5 = $ua5->request($req5);\r\n     if ($resp5->is_success) {\r\n             \r\n     $message5 = $resp5->content;\r\n     print $message5;\r\n\r\n     $message = decode_json($resp5->content);\r\n   \r\nprint $message->{\"quote\"}->{\"body\"};\r\nprint $message->{\"quote\"}->{\"author\"};\r\n\r\n  }\r\nelse {\r\n    print \"HTTP GET error code: \", $resp->code, \"\\n\";\r\n    print \"HTTP GET error message: \", $resp->message, \"\\n\";\r\n}\r\n\r\n<\/code><\/pre>\n<p><strong>References<\/strong><\/p>\n<p>1. <a href=https:\/\/www.entrepreneur.com\/article\/244674 target=\"_blank\">38 of the Most Inspirational Leadership Quotes<\/a><br \/>\n2. <a href=http:\/\/search.cpan.org\/dist\/libwww-perl\/lib\/LWP.pm target=\"_blank\">LWP<\/a><br \/>\n3. <a href=http:\/\/xmodulo.com\/how-to-send-http-get-or-post-request-in-perl.html target=\"_blank\">How to send http get or post request in perl.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>No one can deny the power of a good quote. They motivate and inspire us to be our best. [1] Here are 3 quotes API that can be integrated in your website with source code example in perl. 1. Random Famous Quotes provides a random quote from famous movies in JSON format. This API is &#8230; <a title=\"Quotes API for Web Designers and Developers\" class=\"read-more\" href=\"http:\/\/intelligentonlinetools.com\/blog\/2016\/12\/25\/quotes-api-for-web-designers-and-developers\/\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":[]},"categories":[11,7],"tags":[],"jetpack_publicize_connections":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Quotes API for Web Designers and Developers - Machine Learning Applications<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/intelligentonlinetools.com\/blog\/2016\/12\/25\/quotes-api-for-web-designers-and-developers\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Quotes API for Web Designers and Developers - Machine Learning Applications\" \/>\n<meta property=\"og:description\" content=\"No one can deny the power of a good quote. They motivate and inspire us to be our best. [1] Here are 3 quotes API that can be integrated in your website with source code example in perl. 1. Random Famous Quotes provides a random quote from famous movies in JSON format. This API is ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/intelligentonlinetools.com\/blog\/2016\/12\/25\/quotes-api-for-web-designers-and-developers\/\" \/>\n<meta property=\"og:site_name\" content=\"Machine Learning Applications\" \/>\n<meta property=\"article:published_time\" content=\"2016-12-25T15:20:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-12-26T14:37:47+00:00\" \/>\n<meta name=\"author\" content=\"owygs156\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"owygs156\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/intelligentonlinetools.com\/blog\/2016\/12\/25\/quotes-api-for-web-designers-and-developers\/\",\"url\":\"https:\/\/intelligentonlinetools.com\/blog\/2016\/12\/25\/quotes-api-for-web-designers-and-developers\/\",\"name\":\"Quotes API for Web Designers and Developers - Machine Learning Applications\",\"isPartOf\":{\"@id\":\"https:\/\/intelligentonlinetools.com\/blog\/#website\"},\"datePublished\":\"2016-12-25T15:20:39+00:00\",\"dateModified\":\"2016-12-26T14:37:47+00:00\",\"author\":{\"@id\":\"https:\/\/intelligentonlinetools.com\/blog\/#\/schema\/person\/7a886dc5eb9758369af2f6d2cb342478\"},\"breadcrumb\":{\"@id\":\"https:\/\/intelligentonlinetools.com\/blog\/2016\/12\/25\/quotes-api-for-web-designers-and-developers\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/intelligentonlinetools.com\/blog\/2016\/12\/25\/quotes-api-for-web-designers-and-developers\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/intelligentonlinetools.com\/blog\/2016\/12\/25\/quotes-api-for-web-designers-and-developers\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/intelligentonlinetools.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Quotes API for Web Designers and Developers\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/intelligentonlinetools.com\/blog\/#website\",\"url\":\"https:\/\/intelligentonlinetools.com\/blog\/\",\"name\":\"Machine Learning Applications\",\"description\":\"Artificial intelligence, data mining and machine learning for building web based tools and services.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/intelligentonlinetools.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/intelligentonlinetools.com\/blog\/#\/schema\/person\/7a886dc5eb9758369af2f6d2cb342478\",\"name\":\"owygs156\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/intelligentonlinetools.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/2.gravatar.com\/avatar\/b351def598609cb4c0b5bca26497c7e5?s=96&d=mm&r=g\",\"contentUrl\":\"http:\/\/2.gravatar.com\/avatar\/b351def598609cb4c0b5bca26497c7e5?s=96&d=mm&r=g\",\"caption\":\"owygs156\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Quotes API for Web Designers and Developers - Machine Learning Applications","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/intelligentonlinetools.com\/blog\/2016\/12\/25\/quotes-api-for-web-designers-and-developers\/","og_locale":"en_US","og_type":"article","og_title":"Quotes API for Web Designers and Developers - Machine Learning Applications","og_description":"No one can deny the power of a good quote. They motivate and inspire us to be our best. [1] Here are 3 quotes API that can be integrated in your website with source code example in perl. 1. Random Famous Quotes provides a random quote from famous movies in JSON format. This API is ... Read more","og_url":"https:\/\/intelligentonlinetools.com\/blog\/2016\/12\/25\/quotes-api-for-web-designers-and-developers\/","og_site_name":"Machine Learning Applications","article_published_time":"2016-12-25T15:20:39+00:00","article_modified_time":"2016-12-26T14:37:47+00:00","author":"owygs156","twitter_card":"summary_large_image","twitter_misc":{"Written by":"owygs156","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/intelligentonlinetools.com\/blog\/2016\/12\/25\/quotes-api-for-web-designers-and-developers\/","url":"https:\/\/intelligentonlinetools.com\/blog\/2016\/12\/25\/quotes-api-for-web-designers-and-developers\/","name":"Quotes API for Web Designers and Developers - Machine Learning Applications","isPartOf":{"@id":"https:\/\/intelligentonlinetools.com\/blog\/#website"},"datePublished":"2016-12-25T15:20:39+00:00","dateModified":"2016-12-26T14:37:47+00:00","author":{"@id":"https:\/\/intelligentonlinetools.com\/blog\/#\/schema\/person\/7a886dc5eb9758369af2f6d2cb342478"},"breadcrumb":{"@id":"https:\/\/intelligentonlinetools.com\/blog\/2016\/12\/25\/quotes-api-for-web-designers-and-developers\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/intelligentonlinetools.com\/blog\/2016\/12\/25\/quotes-api-for-web-designers-and-developers\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/intelligentonlinetools.com\/blog\/2016\/12\/25\/quotes-api-for-web-designers-and-developers\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/intelligentonlinetools.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Quotes API for Web Designers and Developers"}]},{"@type":"WebSite","@id":"https:\/\/intelligentonlinetools.com\/blog\/#website","url":"https:\/\/intelligentonlinetools.com\/blog\/","name":"Machine Learning Applications","description":"Artificial intelligence, data mining and machine learning for building web based tools and services.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/intelligentonlinetools.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/intelligentonlinetools.com\/blog\/#\/schema\/person\/7a886dc5eb9758369af2f6d2cb342478","name":"owygs156","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/intelligentonlinetools.com\/blog\/#\/schema\/person\/image\/","url":"http:\/\/2.gravatar.com\/avatar\/b351def598609cb4c0b5bca26497c7e5?s=96&d=mm&r=g","contentUrl":"http:\/\/2.gravatar.com\/avatar\/b351def598609cb4c0b5bca26497c7e5?s=96&d=mm&r=g","caption":"owygs156"}}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7h1IJ-c4","jetpack-related-posts":[{"id":313,"url":"http:\/\/intelligentonlinetools.com\/blog\/2016\/06\/15\/faroo\/","url_meta":{"origin":748,"position":0},"title":"Getting Data from the Web with Perl and The  Guardian API","date":"June 15, 2016","format":false,"excerpt":"In one of previous post the Faroo API was used in order to get data content from the web. In this post we will look at different API that can be also used for downloading content from web. Here we will use the Guardian API \/ open platform. At the\u2026","rel":"","context":"In &quot;API Programming&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":220,"url":"http:\/\/intelligentonlinetools.com\/blog\/2016\/05\/24\/getting-data-from-the-web\/","url_meta":{"origin":748,"position":1},"title":"Getting Data from the Web with Perl and Faroo API","date":"May 24, 2016","format":false,"excerpt":"As stated on Wikipedia \"The number of available web APIs has grown consistently over the past years, as businesses realize the growth opportunities associated with running an open platform, that any developer can interact with.\" [1] For web developers web API (application programming interface) allows to create own application using\u2026","rel":"","context":"In &quot;API Programming&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":383,"url":"http:\/\/intelligentonlinetools.com\/blog\/2016\/07\/03\/getting-the-data-from-the-web-using-php-for-api-using-the-api-with-php\/","url_meta":{"origin":748,"position":2},"title":"Getting the Data from the Web using PHP or Python for API","date":"July 3, 2016","format":false,"excerpt":"In the previous posts [1],[2] perl was used to get content from the web through Faroo API and Guardian APIs. In this post PHP and Pyhton will be used to get web data using same APIs. PHP has a powerful JSON parsing mechanism, which, because PHP is a dynamic language,\u2026","rel":"","context":"In &quot;API Programming&quot;","img":{"alt_text":"Trend for Python, Perl, PHP","src":"https:\/\/i0.wp.com\/intelligentonlinetools.com\/blog\/wp-content\/uploads\/2016\/07\/trend_for_python_perl_php-300x144.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":827,"url":"http:\/\/intelligentonlinetools.com\/blog\/2017\/01\/11\/apis\/","url_meta":{"origin":748,"position":3},"title":"Useful APIs for Your Web Site","date":"January 11, 2017","format":false,"excerpt":"Here\u2019s a useful list of resources on how to create an API, compiled from posts that were published recently on this blog. The included APIs can provide a fantastic ways to enhance websites. 1. The WordPress(WP) API exposes a simple yet powerful interface to WP Query, the posts API, post\u2026","rel":"","context":"In &quot;API Programming&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":76,"url":"http:\/\/intelligentonlinetools.com\/blog\/2016\/02\/13\/downloading-stock-market-data-to-a-google-spreadsheet-with-a-perl-script\/","url_meta":{"origin":748,"position":4},"title":"Downloading Stock Market Data to a Google Spreadsheet with a Perl Script","date":"February 13, 2016","format":false,"excerpt":"In this post will be shown how to download stock market with perl script into Google spreadsheet. Once the data is loaded in Google spreadsheet you can do trend or forecasting analysis and build charts using Google Docs functionality. Perl script helps to automate downloading process, to replace manual downloading\u2026","rel":"","context":"In &quot;Stock data analysis&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":766,"url":"http:\/\/intelligentonlinetools.com\/blog\/2016\/12\/31\/retrieving-post-data-using-the-wordpress-api-with-python-script\/","url_meta":{"origin":748,"position":5},"title":"Retrieving Post Data Using the WordPress API with Python Script","date":"December 31, 2016","format":false,"excerpt":"In this post we will create python script that is able to get data from WordPress (WP) blog using WP API. This script will save downloaded data into csv file for further analysis or other purposes. WP API is returning data in json format and is accessible through link http:\/\/hostname.com\/wp-json\/wp\/v2\/posts.\u2026","rel":"","context":"In &quot;API Programming&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/posts\/748"}],"collection":[{"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/comments?post=748"}],"version-history":[{"count":17,"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/posts\/748\/revisions"}],"predecessor-version":[{"id":750,"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/posts\/748\/revisions\/750"}],"wp:attachment":[{"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/media?parent=748"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/categories?post=748"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/intelligentonlinetools.com\/blog\/wp-json\/wp\/v2\/tags?post=748"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}