Solved

http headers

Posted on 2000-03-28
4
247 Views
Last Modified: 2008-03-06
hi...
this code will raise an error:

<?
echo ("hellow");
header("location:http://www.cnn.com")
?>

because information was already sent to browser.
how can i solved this problem (except of delete the echo "hellow")...
im used to ASP and there i can insert the :
response.buffer=true
i can control the output...
is there something like this in php?

elad
0
Comment
Question by:eladr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 2

Expert Comment

by:gravity
ID: 2665218
Wait until PHP version four is released properly, as opposed to a beta version.

Currently there is *no* way of implementing what you're after.
0
 
LVL 8

Expert Comment

by:us111
ID: 2668142
Answered........

but if you have no code (php or html) behind
the header function you could include a file.
Replace header("location:http://www.cnn.com")
by
include("http://www.cnn.com")

In that case, you can write some text before
0
 

Expert Comment

by:mrvithan
ID: 2668699
Well... If i were you, I would used Javascript to do. Try to use 'window.open("www.cnn.com","_self");'
It get a some effect. But it mightn't what you want!!! :-)

0
 
LVL 2

Accepted Solution

by:
maxkir earned 2 total points
ID: 2672804
mrvithan is close to solution, IMO.
My two cents to your two points ;-) :

<?
echo "aaa";
?>
<SCRIPT language="Javascript">
document.location.href='http://www.cnn.com';
</SCRIPT>
<?
exit;
?>
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question