{"id":617,"date":"2018-08-13T17:57:14","date_gmt":"2018-08-13T23:57:14","guid":{"rendered":"https:\/\/www.ppsstudios.com\/blog\/?p=617"},"modified":"2018-08-13T18:51:47","modified_gmt":"2018-08-14T00:51:47","slug":"super-duper-status-update","status":"publish","type":"post","link":"https:\/\/www.ppsstudios.com\/blog\/2018\/08\/super-duper-status-update\/","title":{"rendered":"Super Duper Status Update"},"content":{"rendered":"<p>It works! I was a bit annoyed that the <a href=\"\/feed\/atom\/\" target=\"_blank\" rel=\"noopener\">wordpress atom feed<\/a> was\u00a0<strong>only<\/strong> XML based. However, I do consider myself pretty good at googling things, and so I found this PHP library called &#8220;<a href=\"http:\/\/php.net\/manual\/en\/book.simplexml.php\" target=\"_blank\" rel=\"noopener\">SimpleXML<\/a>&#8221; which solved a LOT of stuff for me.<\/p>\n<p>I used to display the first five Blogger titles on the <a href=\"https:\/\/www.ppsstudios.com\" target=\"_blank\" rel=\"noopener\">homepage<\/a> in a simple list with links.<!--more--> It was great. I could pass in a <span class=\"lang:default decode:true crayon-inline \">&#8220;format&#8221;=&gt;&#8221;json&#8221;<\/span>\u00a0 array in the post request and get the page contents through <a href=\"http:\/\/php.net\/manual\/en\/book.curl.php\" target=\"_blank\" rel=\"noopener\">php-curl<\/a>. Now with the migration, that functionality partially broke.<\/p>\n<p>Not only did I have to change the URL for the blog feed, but I could not get a json table out of it. And thus, it was necessary to find something that could easily parse the standard XML.<\/p>\n<p>My solution was:<\/p>\n<pre class=\"lang:php decode:true \">$response = preg_replace(\"\/&lt;!\\[CDATA\\[(.*)\\]\\]&gt;\/\",\"$1\",curl_get(\"https:\/\/website\/blog\/feed\/atom\"));\r\n$xml = simplexml_load_string($response);\r\n$json = json_encode($xml);\r\n$js = json_decode($json,TRUE);<\/pre>\n<p>Now you may think this a little overly complex, especially since I&#8217;m taking one array ($xml) and encoding it into a json string, and then back out to a second array. However, simplexml decided to make these library-specific object types which I was not able to reference from just straight PHP. So the double conversion is necessary. (I mean, try it. Run <span class=\"lang:default decode:true crayon-inline \">echo &#8220;&lt;pre&gt;&#8221;; print_r($xml); echo &#8220;&lt;\/pre&gt;&#8221;<\/span>\u00a0 and see what YOU get!)<\/p>\n<p>Plus that cdata stuff was really getting in the way as far as screwing around with the actual text of each feed item. I found <a href=\"https:\/\/coderwall.com\/p\/wiqi7g\/parse-xml-into-associative-array-with-cdata-support\" target=\"_blank\" rel=\"noopener\">this link from coderwal<\/a>l that explained the preg_match thing nicely for this situation, and it worked outright.<\/p>\n<p>Anyway, it works, and although the amount of data I get out is quite mind-blowing, I only want titles and link URLs, so my code has remained quite short on the front page!<\/p>\n<p>Oh, and by the way, the website now has a favicon.<\/p>\n<p>Plus I went through both WordPress Redirection logs AND Google Webmaster Tools 404 logs and found a <strong>bunch<\/strong> of stuff that Google had indexed from Blogger which was generating 404s in WordPress. I think everything is cleaned up (only two or so legitimate permalinks were broken; the rest were stupid GET variables that WP wasn&#8217;t ignoring and other things like search pages).<\/p>\n<p>But I&#8217;ll give it a few days and see if anything else crops up.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It works! I was a bit annoyed that the wordpress atom feed was\u00a0only XML based. However, I do consider myself pretty good at googling things, and so I found this PHP library called &#8220;SimpleXML&#8221; which solved a LOT of stuff for me. I used to display the first five Blogger titles on the homepage in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,121],"tags":[35,34,519,348,33,518,122,517,388],"class_list":["post-617","post","type-post","status-publish","format-standard","hentry","category-programming","category-web","tag-atom","tag-feed","tag-json","tag-php","tag-rss","tag-simplexml","tag-website","tag-wordpress","tag-xml"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Super Duper Status Update - PPSStudios<\/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:\/\/www.ppsstudios.com\/blog\/2018\/08\/super-duper-status-update\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Super Duper Status Update - PPSStudios\" \/>\n<meta property=\"og:description\" content=\"It works! I was a bit annoyed that the wordpress atom feed was\u00a0only XML based. However, I do consider myself pretty good at googling things, and so I found this PHP library called &#8220;SimpleXML&#8221; which solved a LOT of stuff for me. I used to display the first five Blogger titles on the homepage in [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.ppsstudios.com\/blog\/2018\/08\/super-duper-status-update\/\" \/>\n<meta property=\"og:site_name\" content=\"PPSStudios\" \/>\n<meta property=\"article:published_time\" content=\"2018-08-13T23:57:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-08-14T00:51:47+00:00\" \/>\n<meta name=\"author\" content=\"Daniel\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Daniel\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.ppsstudios.com\/blog\/2018\/08\/super-duper-status-update\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.ppsstudios.com\/blog\/2018\/08\/super-duper-status-update\/\"},\"author\":{\"name\":\"Daniel\",\"@id\":\"https:\/\/www.ppsstudios.com\/blog\/#\/schema\/person\/cb11d96049a08f0853830238a95f2888\"},\"headline\":\"Super Duper Status Update\",\"datePublished\":\"2018-08-13T23:57:14+00:00\",\"dateModified\":\"2018-08-14T00:51:47+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.ppsstudios.com\/blog\/2018\/08\/super-duper-status-update\/\"},\"wordCount\":381,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.ppsstudios.com\/blog\/#\/schema\/person\/cb11d96049a08f0853830238a95f2888\"},\"keywords\":[\"atom\",\"feed\",\"json\",\"php\",\"rss\",\"simplexml\",\"website\",\"wordpress\",\"xml\"],\"articleSection\":[\"Programming\",\"Web\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.ppsstudios.com\/blog\/2018\/08\/super-duper-status-update\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.ppsstudios.com\/blog\/2018\/08\/super-duper-status-update\/\",\"url\":\"https:\/\/www.ppsstudios.com\/blog\/2018\/08\/super-duper-status-update\/\",\"name\":\"Super Duper Status Update - PPSStudios\",\"isPartOf\":{\"@id\":\"https:\/\/www.ppsstudios.com\/blog\/#website\"},\"datePublished\":\"2018-08-13T23:57:14+00:00\",\"dateModified\":\"2018-08-14T00:51:47+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.ppsstudios.com\/blog\/2018\/08\/super-duper-status-update\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.ppsstudios.com\/blog\/2018\/08\/super-duper-status-update\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.ppsstudios.com\/blog\/2018\/08\/super-duper-status-update\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.ppsstudios.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Super Duper Status Update\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.ppsstudios.com\/blog\/#website\",\"url\":\"https:\/\/www.ppsstudios.com\/blog\/\",\"name\":\"PPSStudios\",\"description\":\"Formerly \u10d3\u10d0\u10dc\u10d8\u10d4\u10da\u10d8 \u10de\u10d0\u10d5\u10da\u10d8\u10d0\u10e8\u10d5\u10d8\u10da\u10d8\",\"publisher\":{\"@id\":\"https:\/\/www.ppsstudios.com\/blog\/#\/schema\/person\/cb11d96049a08f0853830238a95f2888\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.ppsstudios.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.ppsstudios.com\/blog\/#\/schema\/person\/cb11d96049a08f0853830238a95f2888\",\"name\":\"Daniel\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.ppsstudios.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/3a47193e75f82b6ce5dc02478226e41676f8c8cfbb40d962f0ddff8d18e9e3e1?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/3a47193e75f82b6ce5dc02478226e41676f8c8cfbb40d962f0ddff8d18e9e3e1?s=96&d=mm&r=g\",\"caption\":\"Daniel\"},\"logo\":{\"@id\":\"https:\/\/www.ppsstudios.com\/blog\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/www.ppsstudios.com\"],\"url\":\"https:\/\/www.ppsstudios.com\/blog\/author\/danipavliashvili\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Super Duper Status Update - PPSStudios","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:\/\/www.ppsstudios.com\/blog\/2018\/08\/super-duper-status-update\/","og_locale":"en_US","og_type":"article","og_title":"Super Duper Status Update - PPSStudios","og_description":"It works! I was a bit annoyed that the wordpress atom feed was\u00a0only XML based. However, I do consider myself pretty good at googling things, and so I found this PHP library called &#8220;SimpleXML&#8221; which solved a LOT of stuff for me. I used to display the first five Blogger titles on the homepage in [&hellip;]","og_url":"https:\/\/www.ppsstudios.com\/blog\/2018\/08\/super-duper-status-update\/","og_site_name":"PPSStudios","article_published_time":"2018-08-13T23:57:14+00:00","article_modified_time":"2018-08-14T00:51:47+00:00","author":"Daniel","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Daniel","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.ppsstudios.com\/blog\/2018\/08\/super-duper-status-update\/#article","isPartOf":{"@id":"https:\/\/www.ppsstudios.com\/blog\/2018\/08\/super-duper-status-update\/"},"author":{"name":"Daniel","@id":"https:\/\/www.ppsstudios.com\/blog\/#\/schema\/person\/cb11d96049a08f0853830238a95f2888"},"headline":"Super Duper Status Update","datePublished":"2018-08-13T23:57:14+00:00","dateModified":"2018-08-14T00:51:47+00:00","mainEntityOfPage":{"@id":"https:\/\/www.ppsstudios.com\/blog\/2018\/08\/super-duper-status-update\/"},"wordCount":381,"commentCount":0,"publisher":{"@id":"https:\/\/www.ppsstudios.com\/blog\/#\/schema\/person\/cb11d96049a08f0853830238a95f2888"},"keywords":["atom","feed","json","php","rss","simplexml","website","wordpress","xml"],"articleSection":["Programming","Web"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.ppsstudios.com\/blog\/2018\/08\/super-duper-status-update\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.ppsstudios.com\/blog\/2018\/08\/super-duper-status-update\/","url":"https:\/\/www.ppsstudios.com\/blog\/2018\/08\/super-duper-status-update\/","name":"Super Duper Status Update - PPSStudios","isPartOf":{"@id":"https:\/\/www.ppsstudios.com\/blog\/#website"},"datePublished":"2018-08-13T23:57:14+00:00","dateModified":"2018-08-14T00:51:47+00:00","breadcrumb":{"@id":"https:\/\/www.ppsstudios.com\/blog\/2018\/08\/super-duper-status-update\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.ppsstudios.com\/blog\/2018\/08\/super-duper-status-update\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.ppsstudios.com\/blog\/2018\/08\/super-duper-status-update\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.ppsstudios.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Super Duper Status Update"}]},{"@type":"WebSite","@id":"https:\/\/www.ppsstudios.com\/blog\/#website","url":"https:\/\/www.ppsstudios.com\/blog\/","name":"PPSStudios","description":"Formerly \u10d3\u10d0\u10dc\u10d8\u10d4\u10da\u10d8 \u10de\u10d0\u10d5\u10da\u10d8\u10d0\u10e8\u10d5\u10d8\u10da\u10d8","publisher":{"@id":"https:\/\/www.ppsstudios.com\/blog\/#\/schema\/person\/cb11d96049a08f0853830238a95f2888"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.ppsstudios.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.ppsstudios.com\/blog\/#\/schema\/person\/cb11d96049a08f0853830238a95f2888","name":"Daniel","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.ppsstudios.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/3a47193e75f82b6ce5dc02478226e41676f8c8cfbb40d962f0ddff8d18e9e3e1?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3a47193e75f82b6ce5dc02478226e41676f8c8cfbb40d962f0ddff8d18e9e3e1?s=96&d=mm&r=g","caption":"Daniel"},"logo":{"@id":"https:\/\/www.ppsstudios.com\/blog\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/www.ppsstudios.com"],"url":"https:\/\/www.ppsstudios.com\/blog\/author\/danipavliashvili\/"}]}},"_links":{"self":[{"href":"https:\/\/www.ppsstudios.com\/blog\/wp-json\/wp\/v2\/posts\/617","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ppsstudios.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ppsstudios.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ppsstudios.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ppsstudios.com\/blog\/wp-json\/wp\/v2\/comments?post=617"}],"version-history":[{"count":5,"href":"https:\/\/www.ppsstudios.com\/blog\/wp-json\/wp\/v2\/posts\/617\/revisions"}],"predecessor-version":[{"id":624,"href":"https:\/\/www.ppsstudios.com\/blog\/wp-json\/wp\/v2\/posts\/617\/revisions\/624"}],"wp:attachment":[{"href":"https:\/\/www.ppsstudios.com\/blog\/wp-json\/wp\/v2\/media?parent=617"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ppsstudios.com\/blog\/wp-json\/wp\/v2\/categories?post=617"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ppsstudios.com\/blog\/wp-json\/wp\/v2\/tags?post=617"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}