• 28.08.2025, 22:42
  • Registrieren
  • Anmelden
  • Sie sind nicht angemeldet.

 

speedy909

Full Member

Multipart Array auslesen? (PHP)

Sonntag, 2. März 2008, 11:41

Hallo,

Jetzt komme ich hoffentlich zu meinem letzten Problem! ;D
Ich muss mit dem Folgenden "Multipart" Array arbeiten, das Problem:
das Array kann sich komplett verändern (mehr "Verschachtelungen")

In dem Beispiel handelt es sich um ein HTML E-Mail mit 2 Bildern.
Ich muss je nach "Subtype" besondere Informationen auslesen und verarbeiten, und das egal wieviele Ebenen das Array hat!

Wie mache Ich das am besten?
Ich bin ratlos! :o

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
stdClass Object
(
    [type] => 1
    [encoding] => 0
    [ifsubtype] => 1
    [subtype] => ALTERNATIVE
    [ifparameters] => 1
    [parameters] => Array
        (
            [0] => stdClass Object
                (
                    [attribute] => boundary
                    [value] => Apple-Mail-16-571583282
                )

        )

    [parts] => Array
        (
            [0] => stdClass Object
                (
                    [type] => 0
                    [encoding] => 4
                    [ifsubtype] => 1
                    [subtype] => PLAIN
                    [ifdescription] => 0
                    [ifparameters] => 1
                    [parameters] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [attribute] => charset
                                    [value] => iso-8859-1
                                )

                            [1] => stdClass Object
                                (
                                    [attribute] => format
                                    [value] => flowed
                                )

                            [2] => stdClass Object
                                (
                                    [attribute] => delsp
                                    [value] => yes
                                )

                        )

                )

            [1] => stdClass Object
                (
                    [type] => 1
                    [encoding] => 0
                    [ifsubtype] => 1
                    [subtype] => RELATED
                    [ifparameters] => 1
                    [parameters] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [attribute] => boundary
                                    [value] => Apple-Mail-17-571583282
                                )

                            [1] => stdClass Object
                                (
                                    [attribute] => type
                                    [value] => text/html
                                )

                        )

                    [parts] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [type] => 0
                                    [encoding] => 4
                                    [ifsubtype] => 1
                                    [subtype] => HTML
                                    [ifdescription] => 0
                                    [ifid] => 0
                                    [lines] => 47
                                    [bytes] => 2901
                                    [ifdisposition] => 0
                                    [ifdparameters] => 0
                                    [ifparameters] => 1
                                    [parameters] => Array
                                        (
                                            [0] => stdClass Object
                                                (
                                                    [attribute] => charset
                                                    [value] => iso-8859-1
                                                )

                                        )

                                )

                            [1] => stdClass Object
                                (
                                    [type] => 5
                                    [encoding] => 3
                                    [ifsubtype] => 1
                                    [subtype] => GIF
                                    [ifdescription] => 0
                                    [ifid] => 1
                                    [id] => <1386E479-FDEB-44A3-90F0-1929ECD9762A>
                                    [bytes] => 12756
                                    [ifdisposition] => 1
                                    [disposition] => inline
                                    [ifdparameters] => 1
                                    [dparameters] => Array
                                        (
                                            [0] => stdClass Object
                                                (
                                                    [attribute] => filename
                                                    [value] => logo.gif
                                                )

                                        )

                                    [ifparameters] => 1
                                    [parameters] => Array
                                        (
                                            [0] => stdClass Object
                                                (
                                                    [attribute] => x-unix-mode
                                                    [value] => 0666
                                                )

                                            [1] => stdClass Object
                                                (
                                                    [attribute] => name
                                                    [value] => logo.gif
                                                )

                                        )

                                )

                            [2] => stdClass Object
                                (
                                    [type] => 5
                                    [encoding] => 3
                                    [ifsubtype] => 1
                                    [subtype] => JPEG
                                    [ifdescription] => 0
                                    [ifid] => 1
                                    [id] => <B115DD75-F719-46BD-981A-5350EA169FD1>
                                    [bytes] => 1236
                                    [ifdisposition] => 1
                                    [disposition] => inline
                                    [ifdparameters] => 1
                                    [dparameters] => Array
                                        (
                                            [0] => stdClass Object
                                                (
                                                    [attribute] => filename
                                                    [value] => images.jpg
                                                )

                                        )

                                    [ifparameters] => 1
                                    [parameters] => Array
                                        (
                                            [0] => stdClass Object
                                                (
                                                    [attribute] => x-mac-hide-extension
                                                    [value] => yes
                                                )

                                            [1] => stdClass Object
                                                (
                                                    [attribute] => x-unix-mode
                                                    [value] => 0644
                                                )

                                            [2] => stdClass Object
                                                (
                                                    [attribute] => name
                                                    [value] => images.jpg
                                                )

                                        )

                                )

                        )

                )

        )

)
 

Y0Gi

God

Re: Multipart Array auslesen? (PHP)

Montag, 3. März 2008, 13:21

Stichwort "Rekursion". Übrigens, hast du mal drüber nachgedacht, in der PEAR-Bibliothek nach einem Multipart-E-Mail-Paket zu schauen und das zu verwenden? Gerade E-Mail ist ein sehr gedehntes und variantenreiches Format, das man eher nicht selbst implementieren möchte, ohne auf die vielen Eigenheiten von diveseren MTAs und Clients einzugehen.

speedy909

Full Member

Re: Multipart Array auslesen? (PHP)

Dienstag, 4. März 2008, 09:02

Hallo,

Dieses Wort habe ich schonmal zu diesem Thema gehört, aber ich verstehe nicht ganz was ich damit anfangen soll (von hinten auflösen?)

Eikman

Moderator

Re: Multipart Array auslesen? (PHP)

Dienstag, 4. März 2008, 09:11

http://de.wikipedia.org/wiki/Rekursion

Da sind auch Beispiele dazu.