Krazy-j Posted April 29, 2008 Share Posted April 29, 2008 just ran into a bit of an issue wondering if someone could help out.. ? header("Location: www.urlexample.com/secure/messe...SuccessPage=$url"); Now the only problem with this is it returns the following error message "Warning: Header may not contain more than a single header, new line detected. in C:\wamp\www\login\smsprocess.php on line 25" I have noticed this is due to the fact that $what has new lines? It contains alot of %20's ???? Is there any way to fix this issue? Link to comment https://forums.phpfreaks.com/topic/103350-header-may-not-contain-more-than-a/ Share on other sites More sharing options...
schme16 Posted April 29, 2008 Share Posted April 29, 2008 The only way is to get rid of all the line breaks apparently. you could probably use explode to get rid of them. Like this: <?php $temp_explode = explode(' ', $url); $url = $temp_explode[0]; $temp_explode = NULL; ?> Link to comment https://forums.phpfreaks.com/topic/103350-header-may-not-contain-more-than-a/#findComment-529300 Share on other sites More sharing options...
Krazy-j Posted April 29, 2008 Author Share Posted April 29, 2008 hmm, this seems to not work, is there any other way to do this? Link to comment https://forums.phpfreaks.com/topic/103350-header-may-not-contain-more-than-a/#findComment-529302 Share on other sites More sharing options...
Fadion Posted April 29, 2008 Share Posted April 29, 2008 I have noticed this is due to the fact that $what has new lines? It contains alot of %20's ???? %20 is the encoded "space". Post the value of the $what or $url variables. Probably ull need to run a str_replace() to remove "\n". Link to comment https://forums.phpfreaks.com/topic/103350-header-may-not-contain-more-than-a/#findComment-529304 Share on other sites More sharing options...
mrdamien Posted April 29, 2008 Share Posted April 29, 2008 example of str_replace <?php $chars = array("\n", "\r"); $header = str_replace($chars, "", "Location: www.urlexample.com/secure/messe...SuccessPage={$url}"); header($header); ?> Link to comment https://forums.phpfreaks.com/topic/103350-header-may-not-contain-more-than-a/#findComment-529308 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.