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"); 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? 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. 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 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'; ?> 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. 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 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...? Link to comment https://forums.phpfreaks.com/topic/69625-fopen/#findComment-349899 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.