{"id":25,"date":"2009-12-03T23:38:35","date_gmt":"2009-12-04T07:38:35","guid":{"rendered":"http:\/\/michael.lavaveshkul.com\/blog\/?p=25"},"modified":"2019-02-03T00:04:08","modified_gmt":"2019-02-03T08:04:08","slug":"hello-world","status":"publish","type":"post","link":"https:\/\/michael.lavaveshkul.com\/blog\/2009\/12\/hello-world\/","title":{"rendered":"Hello World!"},"content":{"rendered":"\n<p>I&#8217;m hopping on the bandwagon and getting myself a blog. Don&#8217;t expect too much, though. I tend not to update these things&#8230;<\/p>\n\n\n\n<p>I intend to have this blog cover code, projects I&#8217;m working on, or something related and interesting. However, I will probably post some random stuff, too. I have a couple bad jokes in my head. Keep on the lookout for them. \ud83d\ude00<\/p>\n\n\n\n<p>So, first up, I created a little thing that takes in an <a href=\"http:\/\/sitemaps.org\/protocol.php\">xml sitemap<\/a>, gets all the urls in that sitemap, and checks if they&#8217;re valid with W3C. You can take a peek here: <a href=\"\/\/michael.lavaveshkul.com\/projects\/validation\/validator.php\">michael.lavaveshkul.com\/projects\/validation\/validator.php<\/a><br>I made it synchronously check one url at a time so that I and W3C don&#8217;t get flooded with http requests all at once.<\/p>\n\n\n\n<p>It grabs the urls from the loc tags (from the url tags) and puts them in the table. If you don&#8217;t have javascript turned on, it will determine the validity of each page then (and may take a while to load). If you don&#8217;t, then it turns &#8220;Is Valid&#8221; text in the upper-right corner into a link and automatically clicks when the page loads.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>Clicking that text starts a chain of calls to a little json generating php script that determines if the page for the given url is valid. A call is made for each url. If you&#8217;re wondering how I determine if each page is valid, initially I loaded the whole html document and got the title using <a href=\"http:\/\/us2.php.net\/manual\/en\/book.dom.php\">DOM<\/a>. But then I figured it was a waste to grab the whole page when I only wanted the title, so I used <a href=\"http:\/\/www.php.net\/manual\/en\/function.stream-get-contents.php\">steam_get_contents<\/a> to only get the text around the title tag area and check if &#8220;[Invalid]&#8221; or &#8220;[Valid]&#8221; shows up. After cruising around W3C&#8217;s validation site, I found out I could actually get the status from the headers using their <a href=\"http:\/\/validator.w3.org\/docs\/api.html\">api<\/a>&#8230;<\/p>\n\n\n\n<p>I also found out that they want developers to make their programs sleep for at least 1 second between requests when checking a bunch of pages at once. This wasn&#8217;t a problem on the php side for the non-js version. I can&#8217;t say the same for javascript. If you look at the <a href=\"\/\/michael.lavaveshkul.com\/projects\/validation\/validation.js\">source<\/a>, I actually wanted to use validationCheck2, but I couldn&#8217;t figure out a way to make it wait for a second between requests (besides something like get the time and run a while loop until it&#8217;s 1 second later).<\/p>\n\n\n\n<p>I&#8217;d also like to get the soap output from the api for the javascript version. However, I don&#8217;t think it&#8217;s possible to get it directly from w3.org because of the XMLHttpRequest object isn&#8217;t able to call on services from another domain (usually). Is there any way for me to get around it without having to hit my own server?<\/p>\n\n\n\n<p>This thing is still a work in progress, but you can try it out now. If you don&#8217;t have a sitemap to test with, you can use <a href=\"\/\/michael.lavaveshkul.com\/projects\/validation\/validator.php?sitemap=blah.xml\">blah.xml<\/a>. (Note: If you don&#8217;t have javascript enabled, click &#8220;Go&#8221;.)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m hopping on the bandwagon and getting myself a blog. Don&#8217;t expect too much, though. I tend not to update these things&#8230; I intend to have this blog cover code, projects I&#8217;m working on, or something related and interesting. However, I will probably post some random stuff, too. I have a couple bad jokes in &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/michael.lavaveshkul.com\/blog\/2009\/12\/hello-world\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Hello World!&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-25","post","type-post","status-publish","format-standard","hentry","category-project"],"_links":{"self":[{"href":"https:\/\/michael.lavaveshkul.com\/blog\/wp-json\/wp\/v2\/posts\/25","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/michael.lavaveshkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/michael.lavaveshkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/michael.lavaveshkul.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/michael.lavaveshkul.com\/blog\/wp-json\/wp\/v2\/comments?post=25"}],"version-history":[{"count":4,"href":"https:\/\/michael.lavaveshkul.com\/blog\/wp-json\/wp\/v2\/posts\/25\/revisions"}],"predecessor-version":[{"id":800,"href":"https:\/\/michael.lavaveshkul.com\/blog\/wp-json\/wp\/v2\/posts\/25\/revisions\/800"}],"wp:attachment":[{"href":"https:\/\/michael.lavaveshkul.com\/blog\/wp-json\/wp\/v2\/media?parent=25"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/michael.lavaveshkul.com\/blog\/wp-json\/wp\/v2\/categories?post=25"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/michael.lavaveshkul.com\/blog\/wp-json\/wp\/v2\/tags?post=25"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}