{"id":835,"date":"2014-11-04T05:43:22","date_gmt":"2014-11-04T05:43:22","guid":{"rendered":"http:\/\/www.nikola-breznjak.com\/blog\/?p=835"},"modified":"2015-08-17T06:12:14","modified_gmt":"2015-08-17T06:12:14","slug":"how-to-get-disk-space-usage-and-monthly-bandwidth-transfer-from-cpanel-to-my-website-in-php","status":"publish","type":"post","link":"https:\/\/nikola-breznjak.com\/blog\/stack-overflow\/how-to-get-disk-space-usage-and-monthly-bandwidth-transfer-from-cpanel-to-my-website-in-php\/","title":{"rendered":"How to get Disk Space Usage and Monthly Bandwidth Transfer from cPanel to my website in PHP"},"content":{"rendered":"<p><a href=\"http:\/\/stackoverflow.com\/users\/534755\/nikola\"><img loading=\"lazy\" decoding=\"async\" title=\"profile for Nikola at Stack Overflow, Q&amp;A for professional and enthusiast programmers\" src=\"http:\/\/stackoverflow.com\/users\/flair\/534755.png\" rel=\"lightbox[835]\" alt=\"profile for Nikola at Stack Overflow, Q&amp;A for professional and enthusiast programmers\" width=\"208\" height=\"58\" \/><\/a><br \/>\nI&#8217;m a big fan of <a href=\"http:\/\/stackoverflow.com\/\">Stack Overflow<\/a> and I tend to contribute regularly (am currently in the <a href=\"http:\/\/stackexchange.com\/leagues\/1\/alltime\/stackoverflow\/2008-07-31\/534755?sort=reputationchange#534755\">top 0.X%<\/a>).\u00a0In this category (<a href=\"http:\/\/www.nikola-breznjak.com\/blog\/category\/stack-overflow\/\">stackoverflow<\/a>)\u00a0of posts I will will be posting my top rated questions and answers. This, btw, is allowed as explained in the meta thread <a href=\"http:\/\/meta.stackoverflow.com\/questions\/266971\/can-i-post-so-questions-and-answers-in-a-personal-blog\/266973\">here<\/a>.<\/p>\n<p>My <a href=\"http:\/\/stackoverflow.com\/questions\/6909786\/how-to-get-disk-space-usage-and-monthly-bandwidth-transfer-from-cpanel-to-my-web\">quesiton<\/a> was:<\/p>\n<p style=\"color: #000000;\">I&#8217;m wondering how can I show (get) disk space usage and monthly bandwidth transfer on my website in the same way as it&#8217;s shown when I login to my cPanel account. Is there an api from cPanel for this or is this a general method to do so? I&#8217;m using PHP.<\/p>\n<p style=\"color: #000000;\"><span style=\"line-height: 1.5;\">This answer, by user <a style=\"color: #4a6b82;\" href=\"http:\/\/stackoverflow.com\/users\/113834\/richsage\">richsage<\/a>, was:<\/span><\/p>\n<blockquote>\n<p style=\"color: #000000;\">cPanel\/WHM has an API which offers access to both the elements you&#8217;re looking for. See\u00a0<a style=\"color: #4a6b82;\" href=\"http:\/\/docs.cpanel.net\/twiki\/bin\/view\/ApiDocs\/\" rel=\"nofollow\">the API docs<\/a>for more details. The bandwidth and disk usage modules in API 1 output HTML, however API 2 has an<a style=\"color: #4a6b82;\" href=\"http:\/\/docs.cpanel.net\/twiki\/bin\/view\/SoftwareDevelopmentKit\/ShowAccountInformation\" rel=\"nofollow\">account summary method<\/a>\u00a0which will return the\u00a0<code>diskused<\/code>\u00a0parameter in the appropriate format (XML\/JSON as requested).<\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m a big fan of Stack Overflow and I tend to contribute regularly (am currently in the top 0.X%).\u00a0In this category (stackoverflow)\u00a0of posts I will will be posting&hellip;<\/p>\n","protected":false},"author":1,"featured_media":609,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[],"class_list":["post-835","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-stack-overflow"],"_links":{"self":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/835","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/comments?post=835"}],"version-history":[{"count":2,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/835\/revisions"}],"predecessor-version":[{"id":1704,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/835\/revisions\/1704"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/media\/609"}],"wp:attachment":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/media?parent=835"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/categories?post=835"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/tags?post=835"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}