Solved

http headers

Posted on 2000-03-28
4
227 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
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now