Re: calculate size of remote url

From: Date: Mon, 10 Dec 2001 16:25:23 +0000
Subject: Re: calculate size of remote url
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-14908@lists.php.net to get a copy of this message
"Chidambaram" <chida_cit@yahoo.com> wrote in message news:20011210150211.98388.qmail@web9603.mail.yahoo.com... > Hi > i have to calculate the size of a remote url > ex:http://www.ee.iitm.ernet.in/index.html > i have written a php script but it returns only > the size of html page it doesnot include the images > size in that file could anyone help me in this regard Is this for interest, for once-in-a-while data collection, or for run-on-every-request production code? You would have to parse the HTML file, extract the names of all the images (and CSS files, applets/ActiveX components, and javascript/vbscript inclusions) called, fully qualify the names, remove duplications (which would be served from the client's cache), request the files and check their sizes, then add it all up with some additional time for each request. Alternatively, you could wave your hands and come up with some sort of fudge factor; if you want to be a bit more accurate, set your super-complete-script to try a couple thousand random URLS and scatter-plot the results, HTML-only page size vs. total page size - less reliable but far simpler and faster. If the result is within 20% for 80% of the time, I would be happy. Note that any kind of generated or active page may vary wildly in size anyway - your approach would only work on totally static pages.

« previous php.db (#14908) next »