{"id":185,"date":"2014-06-04T03:02:12","date_gmt":"2014-06-04T11:02:12","guid":{"rendered":"http:\/\/www.tech.dimprash.com\/?p=185"},"modified":"2014-06-04T03:03:29","modified_gmt":"2014-06-04T11:03:29","slug":"185","status":"publish","type":"post","link":"http:\/\/www.tech.dimprash.com\/?p=185","title":{"rendered":"PHP script to report download size of any URL"},"content":{"rendered":"<p>Write a PHP script to report the total download size of any URL. You may not use any 3rd-party code that performs the entire task described below.<\/p>\n<p>No HTML interface is necessary for this exercise; you can write this as a command-line script that accepts the URL as an argument.<\/p>\n<p>For a single-file resource such as an image or SWF, the script would simply report on the total size of the document.<\/p>\n<p>For a complex resource such as an HTML document, the script would need to parse it to find references to embedded, included resources: javascript files, CSS files, iframes, etc.<\/p>\n<p>The goal of this exercise is to output the following information for a given URL:<br \/>\n&#8211; total number of HTTP requests<br \/>\n&#8211; total download size for all requests<\/p>\n<p>Answer: <a href=\"http:\/\/www.programmerinterview.com\/index.php\/php-questions\/php-interview-questions-and-answers\/\">http:\/\/www.programmerinterview.com\/index.php\/php-questions\/php-interview-questions-and-answers\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Write a PHP script to report the total download size of any URL. You may not use any 3rd-party code that performs the entire task described below. No HTML interface is necessary for this exercise; you can write this as a command-line script that accepts the URL as an argument. For a single-file resource such &hellip; <a href=\"http:\/\/www.tech.dimprash.com\/?p=185\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">PHP script to report download size of any URL<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-185","post","type-post","status-publish","format-standard","hentry","category-php"],"_links":{"self":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/185","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=185"}],"version-history":[{"count":3,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/185\/revisions"}],"predecessor-version":[{"id":188,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/185\/revisions\/188"}],"wp:attachment":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=185"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=185"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=185"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}