Forum Moderators: coopster

Message Too Old, No Replies

Calculating the size of a web page and storing it into a database.

filesize(); doesn't work - readfile(); works but shows the whole page

         

sidyadav

9:29 am on May 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I want to calculate the size of a webpage (ie. size.php?url=http://www.foo-site.com/foo.html) and store it into a MySQL db.
(It's actually for a different reason, for one of my big projects but the answer to the question above should work.)

I tried filesize(), but it only calculates the size of a file placed within the folder (I want to calculate the size of a page/site which is of course not in the root, and is somewhere else).

In other words, it gave me the following error:

Warning: filesize(): Stat failed for ht*p://www.foo-site.com/foo.html (errno=2 - No such file or directory) in /home/www/size.php on line 136

Next, I tried the readfile() function, which worked, and stored the size of the document into the MySQL db - but it showed a preview of the whole webpage I applied (as you see when using the include() function) instead of showing it's size.

What I really want to do, is show the size of the URL applied and also store it into a MySQL database.

Is there any way of doing this?

Any help would be most appreciated,
Sid

sidyadav

12:45 pm on May 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just figured it out :):
[holovaty.com...]

Thanks Google! ;)

Sid

lorax

2:31 pm on May 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Nice find - yet another tool to add. :)

henry0

7:49 pm on May 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ageed, nice tool
however what can be any application?

using ebay to sale page by the pound :)

Hmm, really would like to hear about using it ... for?

regards

Henry