corillo181 Posted September 17, 2007 Share Posted September 17, 2007 what fopen works with short directories but not with full directories this works $f = fopen("textdocs/test.txt","r"); but this dont $f = fopen("http://www.xxx.com/textdocs/test.txt","r"); Quote Link to comment https://forums.phpfreaks.com/topic/69625-fopen/ Share on other sites More sharing options...
pocobueno1388 Posted September 17, 2007 Share Posted September 17, 2007 In the manual it shows an example like this: $handle = fopen("http://www.example.com/", "r"); So I would assume that it should work...what about it doesn't work? Quote Link to comment https://forums.phpfreaks.com/topic/69625-fopen/#findComment-349851 Share on other sites More sharing options...
corillo181 Posted September 17, 2007 Author Share Posted September 17, 2007 it shows nothing when i use the short version, it show the text when i use the full version it does not show anything. Quote Link to comment https://forums.phpfreaks.com/topic/69625-fopen/#findComment-349853 Share on other sites More sharing options...
corillo181 Posted September 17, 2007 Author Share Posted September 17, 2007 alright i found the problem i didn't show my whole code cuz i thought it would not matter but is th efilesize that doe snot read it. <?php $F = fopen("http://www.xxx.com/textdocs/test.txt","r"); $size = filesize("http://www.xxx.com/textdocs/test.txt"); $data = fread($F, $size); fclose($F); print $data; ?> how can i make filesize work Quote Link to comment https://forums.phpfreaks.com/topic/69625-fopen/#findComment-349858 Share on other sites More sharing options...
darkfreaks Posted September 17, 2007 Share Posted September 17, 2007 <?php ///outputs the filesize in test.txt $filename = 'test.txt'; echo $filename . ': ' . filesize($filename) . ' bytes'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/69625-fopen/#findComment-349863 Share on other sites More sharing options...
corillo181 Posted September 17, 2007 Author Share Posted September 17, 2007 that only work when a file is given with the directory not the file website path. Quote Link to comment https://forums.phpfreaks.com/topic/69625-fopen/#findComment-349871 Share on other sites More sharing options...
darkfreaks Posted September 17, 2007 Share Posted September 17, 2007 should work using filesize <?php filesize('http://www.mysite.com/test.text','r');?> try putting an r so it can read the file since your using fopen Quote Link to comment https://forums.phpfreaks.com/topic/69625-fopen/#findComment-349872 Share on other sites More sharing options...
d22552000 Posted September 17, 2007 Share Posted September 17, 2007 *cough* *cough* fopen it, then fread it into a string, run strlen($string); ? do you ahve url fopens allowed in php.ini...? Quote Link to comment https://forums.phpfreaks.com/topic/69625-fopen/#findComment-349899 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.