PHP  
downloads | documentation | faq | getting help | mailing lists | | php.net sites | links 
search for in the  
<gmp_xorheader>
Last updated: Wed, 15 Jan 2003
view the printer friendly version or the printer friendly version with notes or change language to English | Brazilian Portuguese | Chinese (Simplified) | Chinese (Traditional) | Czech | Dutch | Finnish | French | German | Hebrew | Hungarian | Japanese | Korean | Polish | Romanian | Russian | Slovak | Slovenian | Spanish | Swedish | Turkish

XXXVII. Funzioni HTTP

Queste funzioni permettono di modificare l'output inviato verso un browser attraverso manipolazioni a livello di protocollo HTTP.

Sommario
header -- Spedisce un header HTTP
headers_sent -- Restituisce TRUE se gli header sono stati trasmessi.
setcookie -- Spedisce un cookie
User Contributed Notes
Funzioni HTTP
add a note about notes
jrochkin at cs dot oberlin dot edu
24-Mar-2000 10:54

See the file() function. It works on http requests too, even though it's grouped with filesystem functions.
dave at kineticenergy dot com
28-Mar-2000 07:49

try this to get your current url
$filelocation=$HTTP_HOST.$PHP_SELF;
echo($filelocation);

hercules at drinkspecials dot com
23-Apr-2000 04:50

To make a page that refreshes itself every 10 seconds, use a meta tag. <META HTTP-EQUIV="Refresh" CONTENT="10; URL=>
The previous tag will cause the page that you are on to refresh in 10 seconds
to .

dhpainter at msn dot com
26-Apr-2000 05:35

To create a link to the previous page you can use the
getenv("HTTP_REFERER")
command and  set it up as a hyperlink. You might also want to put a IF condition on it so it won't get displayed if the user has gone straight in to the page.

rob at OhReally dot com
29-Jun-2000 03:59

To display the current URL, I'd rather use
$REQUEST_URI
or
$SERVER_NAME.$REQUEST_URI
This will include the query-string.
Make a phpinfo() file to see all environment variables.

Rob

rob at OhReally dot com
08-Jul-2000 03:22

To redirect your visitors without interference (no warning/explanation) you should use
header("Location: );
If you would first like to tell your visitors what is going to happen ('You'll be redirected in 5 secs') you should consider meta-tags or JavaScript.

jeffp-php at outofservice dot com
05-Jan-2001 03:37

$HTTP_RAW_POST_DATA --

You'll usually access variables from forms sent via POST method by just accessing the associated PHP global variable.

However, if your POST data is not URI encoded (i.e., custom application that's not form-based) PHP won't parse the data into nice variables for you.  You will need to use $HTTP_RAW_POST_DATA to access the raw data directly. (This should return a copy of the data given to the PHP process on STDIN; note that you wan't be able to open STDIN and read it yourself because PHP already did so itself.)

krisj at blueridge dot net
23-Jan-2001 11:41

When using the $SERVER_NAME or other predefined variables within a function BE SURE to use $GLOBALS["SERVER_NAME"] in its place =)
tl dot NO SPAM at ccf dot NO SPAM dot fr
16-May-2001 08:18

Please note, in previous message, Decode_Chunked_Message() function will fail in some case (whitespace between chunk size and crlf)
To avoid this :
modify line $chunk_size=substr($message,$chunk_pos,$crlf_pos);
by
$chunk_size=chop(substr($message,$chunk_pos,$crlf_pos));
AND
$chunk_size=substr($message,$chunk_pos,$crlf_pos-$chunk_pos);
BY
$chunk_size=chop(substr($message,$chunk_pos,$crlf_pos-$chunk_pos));

paul at siroccoh dot com
30-Jun-2002 06:04

Redirecting:
If you want the URL you are redirecting to with header("Location: $url") to appear in the location bar in your browser, you have to add a <CRLF> at the end of the string; ie header("Location: blah.com\r\n") It'll still redirect without the \r\n but for some reason the URL remains unchanged in the location bar.

tom at tom420 dot com
12-Aug-2002 06:42

The last post must be related with an older version of some browser. I've tried it with both IE 6.0 (which comes with XP) and Mozilla 1.1, both with \r\n and without it, and in both cases the new URL shows up in the address bar.

I do remember such a glitch with IE in the past however.

nf at wh3rd dot net
06-Sep-2002 06:57

If you're wanting to perform an HTTP POST, I've written a small but useful function to do so:


add a note about notes
<gmp_xorheader>
Last updated: Wed, 15 Jan 2003
show source | credits | mirror sites
Copyright © 2001-2003 The PHP Group
All rights reserved.
This mirror generously provided by: /
Last updated: Sun Jan 19 09:13:02 2003 CET