Bonjour,

je cherche à extraire puis compter les domaines sans prendre en compte les sous-domaines, répertoire, page ...

Voici un échantillon d'une liste d'urls:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
$uri = array(
'http://www.domaine.com',
'http://www.domaine.com',
'http://www.domaine.com/page.php',
'http://www.domaine.com/directory/',
'http://www.domaine.com/directory/page.php',
'http://www.subdomaine.domaine.com/',
'http://www.subdomaine.domaine.com/page.php',
'http://www.subdomaine.domaine.com/directory/',
'http://www.subdomaine.domaine.com/directory/',
'http://www.subdomaine.domaine.com/directory/page.php',
'http://www.subdomaine.subdomaine.domaine.com/',
'http://www.subdomaine.subdomaine.domaine.com/page.php',
'http://www.subdomaine.subdomaine.domaine.com/directory/',
'http://www.subdomaine.subdomaine.domaine.com/directory/page.php',
'http://domaine.us',
'http://domaine.us/page.php',
'http://domaine.us/directory/',
'http://domaine.us/directory/',
'http://domaine.us/directory/page.php',
'http://subdomaine.domaine.us/',
'http://subdomaine.domaine.us/page.php',
'http://subdomaine.domaine.us/directory/',
'http://subdomaine.domaine.us/directory/',
'http://subdomaine.domaine.us/directory/page.php',
'http://subdomaine.subdomaine.domaine.us/',
'http://subdomaine.subdomaine.domaine.us/page.php',
'http://subdomaine.subdomaine.domaine.us/directory/',
'http://subdomaine.subdomaine.domaine.us/directory/page.php');
le résultat voulu:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
2 domaines trouvés (domaine.com et domaine.us)
J'ai donc tester avec différents masques et parse_url mais je n'arrive pas obtenir le résultat souhaiter.

Merci pour votre aide.