Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
PHP: imap_fetchheader - Manual
[go: Go Back, main page]

PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

imap_fetchstructure" width="11" height="7"/> <imap_fetchbody
Last updated: Mon, 05 Feb 2007

view this page in

imap_fetchheader

(PHP 4, PHP 5)

imap_fetchheader — メッセージのヘッダを返す

説明

string imap_fetchheader ( resource imap_stream, int msg_number [, int options] )

指定したメッセージについて、フィルタリング されていない完全な » RFC2822 フォーマットのヘッダをテキスト文字列として取得します。

パラメータ

imap_stream

imap_open() が返す IMAP ストリーム。

msg_number

メッセージ番号。

options

オプション options は次のようになります。

  • FT_UID - 引数 msgno は UID です。
  • FT_INTERNAL - 返される文字列は "internal" フォーマットです。CRLF は正規化しません。
  • FT_PREFETCHTEXT - RFC822.TEXT を、 同時に事前に取得しておく必要があります。これは、メッセージテキスト 全体を取得したい場合(例:「ローカルファイルに保存する」操作)に IMAP 接続で余分な RTT を回避します。

返り値

指定したメッセージのヘッダをテキスト文字列で返します。

参考

imap_fetch_overview()



add a note add a note User Contributed Notes
imap_fetchheader
dj_doktor at upskirt dot cz
03-Apr-2005 11:17
I spend lot of time find out how I can detect messages with
different priorities. When I read users notes I remember
function imap_fetchheader which show header of message
and additional headers too. Because I'm so lazy to work with
regular expressions I required my frend for writing code
- thanx Znouza.
And there is... :)

<?php
  
// connecting to imap mailserver
  
$connection = @imap_open("{localhost:143/imap}INBOX", "your_username", "your_password");

  
// get imap_fetch header and put single lines into array
  
$header = explode("\n", imap_fetchheader($connection, 1));

  
// browse array for additional headers
  
if (is_array($header) && count($header)) {
      
$head = array();
       foreach(
$header as $line) {
          
// is line with additional header?
          
if (eregi("^X-", $line)) {
              
// separate name and value
              
eregi("^([^:]*): (.*)", $line, $arg);
              
$head[$arg[1]] = $arg[2];
           }
       }
   }

  
// now are all contained additional headers in array $head
?>

 
show source | credits | sitemap | contact | advertising | mirror sites