If you want to make outgoing http connections with php, concider the curl extension.
Funciones de HTTP
Las funciones internas relacionadas con HTTP listadas anteriormente en esta página se pueden encontrar en la categoría funciones de red.
Para las siguientes funciones no se necesita que el módulo HTTP esté presente: header(), headers_list(), headers_sent(), setcookie() y setrawcookie().
Grupos de funciones
Codificación
Variadas
Gestión de resultados
Peticiones
Respuestas
Gestión de la persistencia
Tabla de contenidos
- http_cache_etag — Guardando en caché a partir de ETag
- http_cache_last_modified — Guardando en caché por última modificación
- http_chunked_decode — Decodifica datos fragmentados
- http_deflate — Comprimir datos
- http_inflate — Descomprimir datos
- http_build_cookie — Construir el string de una cookie
- http_date — Compone una fecha HTTP compatible con el RFC
- http_get_request_body_stream — Consultar cuerpo de la petición como un flujo
- http_get_request_body — Consultar cuerpo de petición como string
- http_get_request_headers — Obtener cabeceras de petición como array
- http_match_etag — Comprobar si coincide el ETag
- http_match_modified — Comprobar si coincide la última modificación
- http_match_request_header — Comprobar si coincide cualquier cabecera
- http_support — Comprueba el soporte HTTP integrado
- http_negotiate_charset — Negociar el conjunto de caracteres preferido por los clientes
- http_negotiate_content_type — Negociar el tipo de contenido preferido por los clientes
- http_negotiate_language — Negociar el idioma preferido de los clientes
- ob_deflatehandler — Comprimir el manejador de salidas
- ob_etaghandler — Manejador de salida de ETag
- ob_inflatehandler — Descromprimir el Manejador de salidas
- http_parse_cookie — Analizar una cookie HTTP
- http_parse_headers — Convierte cabeceras HTTP
- http_parse_message — Analizar mensajes HTTP
- http_parse_params — Analizar lista de parámetros
- http_persistent_handles_clean — Cierra el control de persistencia
- http_persistent_handles_count — Estadísticas del control del persistencias
- http_persistent_handles_ident — Obtener/modificar el identificador del control de persistencia
- http_get — Realizar una petición GET
- http_head — Realizar una petición HEAD
- http_post_data — Realizar una petición POST con datos pre-codificados
- http_post_fields — Realizar una petición POST con datos a codificar
- http_put_data — Realizar una petición PUT con datos
- http_put_file — Realizar una petición PUT con un fichero
- http_put_stream — Realizar una petición PUT a partir de un flujo
- http_request_body_encode — Codificar el contenido de una petición
- http_request_method_exists — Comprueba si existe un método de petición
- http_request_method_name — Obtener nombre de método de petición
- http_request_method_register — Da de alta un método de petición
- http_request_method_unregister — Dar de baja un método de petición
- http_request — Realizar una petición personalizada
- http_redirect — Realiza una redirección HTTP
- http_send_content_disposition — Enviar la cabecera Content-Disposition
- http_send_content_type — Enviar cabecera Content-Type
- http_send_data — Enviar datos arbitrarios
- http_send_file — Enviar un fichero
- http_send_last_modified — Enviar cabecera Last-Modified
- http_send_status — Enviar código de estado HTTP
- http_send_stream — Enviar flujo
- http_throttle — Aceleración de HTTP
- http_build_str — Construir string de consulta
- http_build_url — Construir una URL
henke dot andersson at comhem dot se ¶
7 years ago
woei at xs4all dot nl ¶
7 years ago
Actually, if you want to redirect a user why let HTML or JavaScript do it? Simply do this:
header("Location: http://www.example.com/");
WeeJames ¶
8 years ago
Regarding what the guy before said. We've experienced problems where certain firewalls have encrypted the HTTP_REFERER meaning that it doesnt always contain the place you've come from.
Better to track where the user has come from either in a form post or in the url.
Anonymous ¶
9 years ago
in reference to toashwinisidhu's and breaker's note, a more effective way would be to use meta-tag redirect, for example.
<?php
$url = "http://somesite.com/index.php"; // target of the redirect
$delay = "3"; // 3 second delay
echo '<meta http-equiv="refresh" content="'.$delay.';url='.$url.'">';
?>
The meta goes in the head of the HTML.
This method does not require javascript and is supported by most browsers and is rarely, if ever, filterd out.
toashwinisidhu at yahoo dot com ¶
9 years ago
The method given below may not sometimes work.
The following method has always worked with me:
just put the following 3 lines in your PHP code
?>
<body onload=setTimeout("location.href='$url'",$sec)>
<?PHP
-------?>
$sec is the time in second after which the browser would automatically go to the url. Set it to 0 if you do not want to give any time.
You can use this function on the events of various html/form objects (eg.-onclick for button).eg.
<input type=button value="Go to Php.net" onclick=setTimeout("location.href='php.net'",0)>
Use this to one step back
<input type="button" value="Back" onclick=history.go(-1)>
jeffp-php at outofservice dot com ¶
12 years ago
$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.)
