ammar77 Posted February 10, 2009 Share Posted February 10, 2009 Hi, i have an error message while running this random link redirection script, this script uses a urls.txt file to select random links.. link structure of urls.txt http://www.yahoo.com http://www.google.com http://www.live.com random.php <? $file = "urls.txt"; $fp = file($file); $urls = $fp[array_rand($fp)]; header("Location: $urls"); ?> error i got: Warning: Cannot modify header information - headers already sent by (output started at /home/user/public_html/random.php:1) in /home/user/public_html/random.php on line 5 kindly do some needful. thanks. Quote Link to comment https://forums.phpfreaks.com/topic/144694-error-cannot-modify-header-information/ Share on other sites More sharing options...
premiso Posted February 10, 2009 Share Posted February 10, 2009 Make sure that you do not have any white spaces at the top of your script: Invalid: <?php ?> Valid: <?php ?> Quote Link to comment https://forums.phpfreaks.com/topic/144694-error-cannot-modify-header-information/#findComment-759269 Share on other sites More sharing options...
metrostars Posted February 10, 2009 Share Posted February 10, 2009 It means you have some HTML or echoed php above the script. Make sure there's no html above, inluding spaces, new lines etc. Quote Link to comment https://forums.phpfreaks.com/topic/144694-error-cannot-modify-header-information/#findComment-759270 Share on other sites More sharing options...
ammar77 Posted February 10, 2009 Author Share Posted February 10, 2009 thanks. it now working Quote Link to comment https://forums.phpfreaks.com/topic/144694-error-cannot-modify-header-information/#findComment-759284 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.