Jump to content

get the size of the output of a php file?


colfaxrev

Recommended Posts

Is there a way of getting the final size in bytes of the output of a php file?

i have a separate php file that is doing the following...

[code]
print "filesize[" . filesize('roro3.flv') . "]";
[/code]

which outputs...
filesize[18492343]

so that works fine...

I want to get the FINAL size in bytes for the output of a php file... i tried this (which i was sure wouldn't work)

[code]
print "filesize[" . filesize('tracking.php?action=show') . "]";
[/code]

You can see that file for youself here...
http://triotalentagency.com/newsite/tracking.php?action=show

but that code prints out this...

filesize[]

i also tried to use readfile() but that didn't seem to work....
is there anyway to do this?

thanks!
Link to comment
Share on other sites

if you are trying to find the size of the output of a page that will always be a constant size you can probably do this:

[code]
$site = file_get_contents('http://www.mywebsite.com/tracking.php?action=show');
print "filesize[" . strlen($site) . "]";
[/code]

I believe that "filesize" only works for local files, so "filesize('http://www.mywebsite.com/tracking.php?action=show')" wouldn't work. Since 'http://www.mywebsite.com/tracking.php?action=show' is clearly not local.

Also, if what you were attempting to do was to retrieve the file locally, the script would be looking for a file named 'tracking.php?action=show', not a file named 'tracking.php'.

(Also retreiving a php file locally gets the code of the file, not the output. ie: filesize("helloworld.php") would get the length of "<?php echo 'Hello World'; ?>" rather than the length of "Hello World")
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.