Note: the Classes are Only available in PHP5, the functions however work in both PHP4 and PHP5.
HTTP 関数
このページですでに取り上げられた組み込みの HTTP 関連関数については ネットワーク関数 に説明があります。
以下の関数は、HTTP モジュールを必要としません。 header()、headers_list()、headers_sent()、 setcookie() そして setrawcookie()。
関数群
雑多な関数
リクエスト
レスポンス
目次
- http_cache_etag — ETag でキャッシュする
- http_cache_last_modified — 最終更新日時でキャッシュする
- http_chunked_decode — chunked-encoded データをデコードする
- http_deflate — データを圧縮する
- http_inflate — データを展開する
- http_build_cookie — クッキー文字列を作成する
- http_date — HTTP の RFC に準拠した日付を作成する
- http_get_request_body_stream — リクエストの本文をストリームとして取得する
- http_get_request_body — リクエストの本文を文字列として取得する
- http_get_request_headers — リクエストヘッダを配列として取得する
- http_match_etag — ETag を比較する
- http_match_modified — 最終更新日時を比較する
- http_match_request_header — 任意のヘッダを比較する
- http_support — 組み込みの HTTP サポートを調べる
- http_negotiate_charset — クライアントが希望している文字セットを選択する
- http_negotiate_content_type — クライアントが希望している content type を選択する
- http_negotiate_language — クライアントが希望している言語を選択する
- ob_deflatehandler — 圧縮出力ハンドラ
- ob_etaghandler — ETag 出力ハンドラ
- ob_inflatehandler — 展開出力ハンドラ
- http_parse_cookie — HTTP クッキーをパースする
- http_parse_headers — HTTP ヘッダをパースする
- http_parse_message — HTTP メッセージをパースする
- http_parse_params — パラメータリストをパースする
- http_persistent_handles_clean — 持続ハンドルを消去する
- http_persistent_handles_count — 持続ハンドルの状況
- http_persistent_handles_ident — 持続ハンドルの ident を取得/設定する
- http_get — GET リクエストを実行する
- http_head — HEAD リクエストを実行する
- http_post_data — エンコードされたデータを使用して POST リクエストを実行する
- http_post_fields — エンコードされる前のデータを使用して POST リクエストを実行する
- http_put_data — データを使用して PUT リクエストを実行する
- http_put_file — ファイルを使用して PUT リクエストを実行する
- http_put_stream — ストリームを使用して PUT リクエストを実行する
- http_request_body_encode — リクエスト本文をエンコードする
- http_request_method_exists — リクエストメソッドが存在するかどうかを調べる
- http_request_method_name — リクエストメソッド名を取得する
- http_request_method_register — リクエストメソッドを登録する
- http_request_method_unregister — リクエストメソッドの登録を解除する
- http_request — 独自のリクエストを実行する
- http_redirect — HTTP リダイレクトを発行する
- http_send_content_disposition — Content-Disposition を送信する
- http_send_content_type — Content-Type を送信する
- http_send_data — 任意のデータを送信する
- http_send_file — ファイルを送信する
- http_send_last_modified — Last-Modified を送信する
- http_send_status — HTTP レスポンスステータスを送信する
- http_send_stream — ストリームを送信する
- http_throttle — HTTP 抑止処理
- http_build_str — クエリ文字列を組み立てる
- http_build_url — URL を組み立てる
HTTP 関数
alan at akbkhome dot com
11-Aug-2006 12:19
11-Aug-2006 12:19
henke dot andersson at comhem dot se
15-Jan-2006 05:01
15-Jan-2006 05:01
If you want to make outgoing http connections with php, concider the curl extension.
woei at xs4all dot nl
30-Nov-2005 11:57
30-Nov-2005 11:57
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
08-Jul-2004 02:39
08-Jul-2004 02:39
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.
28-Apr-2004 10:05
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
21-Apr-2004 06:55
21-Apr-2004 06:55
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
05-Jan-2001 12:37
05-Jan-2001 12: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.)
