|
Categorieën >
PHP
Msn contacten uitlezen (Opgelost)
|
|
|
offline
|
PHP ver gevorderde
|
Hoe kan ik uit een .ctt (gewoon xml) bestand de contactpersonen uitlezen.
Bestand is zo opgebouwd:
<?xml version="1.0"?>
<messenger>
<service name=".NET Messenger Service">
<contactlist>
<contact type="1">emailadres</contact>
<contact type="1">emailadres</contact>
<contact type="1">emailadres</contact>
<contact type="1">emailadres</contact>
<contact type="1">emailadres</contact>
<contact type="1">emailadres</contact>
</contactlist>
</service>
</messenger>
<?xml version="1.0"?> <messenger> <service name=".NET Messenger Service"> <contactlist> <contact type="1">emailadres</contact> <contact type="1">emailadres</contact> <contact type="1">emailadres</contact> <contact type="1">emailadres</contact> <contact type="1">emailadres</contact> <contact type="1">emailadres</contact> </contactlist> </service> </messenger>
ik wil een array met elk element een email adres..
al die rss parsers zijn niet wat ik zoek |
4 antwoorden
timo – 06/12/2007 18:26
|
|
offline
|
PHP ver gevorderde
|
|
|
|
|
offline
|
Crew Javascript
|
<?php
preg_replace('~<contact type="(.*?)">(.*?)</contact>~sie', "\$array['\\2'] = '\\1';", $xml);
?>
<?php preg_replace('~<contact type="(.*?)">(.*?)</contact>~sie', "\$array['\\2'] = '\\1';", $xml); ?>
Zo komt de resultaten van de regex in de array $array. Je moet wel oppassen, want er mogen niet dubbele e-mail adressen in de XML bestand staan.
|
timo – 06/12/2007 18:32
|
|
offline
|
PHP ver gevorderde
|
zo werkt ie:-) thx
|
Dit onderwerp is gesloten.
|
|
|