shadiadiph Posted July 18, 2009 Share Posted July 18, 2009 can any one explain why the first one works and the second one doesn't?? // Create email account $f = fopen ("http://$cpuser:$cppass@$cpdomain:2082/frontend/$cpskin/mail/doaddpop.html?email=$euser&domain=$cpdomain&password=$epass"a=$equota", "r"); // Check result while (!feof ($f)) { $line = fgets ($f, 1024); if (ereg ("already exists", $line, $out)) { $msg = "<h2>Email account {$euser}@{$edomain} already exists.</h2>"; break; } } @fclose($f); // Create email account $f = fopen ("http://$cpuser:$cppass@$cpdomain:2082/frontend/$cpskin/mail/doaddpop.html?email=$euser&domain=$cpdomain&password=$epass"a=$equota", "r"); @fclose($f); Link to comment https://forums.phpfreaks.com/topic/166403-solved-can-anyone-explain-this-fopen/ Share on other sites More sharing options...
trq Posted July 18, 2009 Share Posted July 18, 2009 No. Link to comment https://forums.phpfreaks.com/topic/166403-solved-can-anyone-explain-this-fopen/#findComment-877476 Share on other sites More sharing options...
shadiadiph Posted July 18, 2009 Author Share Posted July 18, 2009 mm i don't get it either i only took out the check while loop as i don't need it to check doesn't look like it does anything except return an error but works if i change the while loop to just // check result while (!feof ($f)) { $line = fgets ($f, 1024); } Link to comment https://forums.phpfreaks.com/topic/166403-solved-can-anyone-explain-this-fopen/#findComment-877480 Share on other sites More sharing options...
trq Posted July 18, 2009 Share Posted July 18, 2009 I actually meant, no, we can't explain it because you haven't given us enough details to do so. Link to comment https://forums.phpfreaks.com/topic/166403-solved-can-anyone-explain-this-fopen/#findComment-877496 Share on other sites More sharing options...
shadiadiph Posted July 18, 2009 Author Share Posted July 18, 2009 mm don't know what you want me to explain this is to add an email user to the cpanel on my domain was just wondering why the first one worked and why the second one didn't why does fopen require // check result while (!feof ($f)) { $line = fgets ($f, 1024); } at minimum to work didn;t seem like the above does anything? Link to comment https://forums.phpfreaks.com/topic/166403-solved-can-anyone-explain-this-fopen/#findComment-877504 Share on other sites More sharing options...
trq Posted July 18, 2009 Share Posted July 18, 2009 The looped one read in 1024 bytes at a time until it gets to the end of the file. Link to comment https://forums.phpfreaks.com/topic/166403-solved-can-anyone-explain-this-fopen/#findComment-877506 Share on other sites More sharing options...
shadiadiph Posted July 28, 2009 Author Share Posted July 28, 2009 thank you for the explanation Link to comment https://forums.phpfreaks.com/topic/166403-solved-can-anyone-explain-this-fopen/#findComment-885243 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.