Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > it.comp.www.php > #21242
| From | Leonardo Serni <lserni@gmail.com> |
|---|---|
| Newsgroups | it.comp.www.php |
| Subject | Re: Ricerca email |
| Date | 2016-10-26 19:10 +0200 |
| Organization | CELT |
| Message-ID | <gtn11cpprhcj5f6nbn2vog65g3k528lem4@L.Serni> (permalink) |
| References | <2016102507505622013@mynewsgate.net> <s3fv0chn5o7ch411uute9l9amq310mn9uk@L.Serni> <2016102607021522013@mynewsgate.net> <6o911chgcap2d952aq95pfttt9v20dvn6o@L.Serni> <2016102613230722013@mynewsgate.net> |
On Wed, 26 Oct 2016 13:23:07 GMT, "infoannu" <22013invalid@mynewsgate.net> wrote:
> Ti allego di nuovo lo script
OK. Allora, questa versione dello script l'ho appena verificata funzionare dal mio server.
Tu dici che dal tuo sito il download di siti terzi non dia alcun problema; io lo prendo per buono.
<?php
define('EMAIL_REGEX', '#[a-z0-9\\.!\\$%&*+/=\\?^_\\{\\|\\}~-]+@[a-z0-9-]+(?:\\.[a-z0-9-]+)*#i');
function leggi_codice($sito) {
$text = file_get_contents($sito);
if (empty($text)) {
// Questo vuol dire che il server PHP non è in grado
// di connettersi e scaricare il sito bersaglio.
return array('impossibile@leggere.il.sito');
}
$matches = null;
preg_match_all(EMAIL_REGEX, $text, $matches);
return $matches[0];
}
function estrai_mail($var) {
$emails = array_unique(array_map('trim', $var));
sort($emails);
return $emails;
}
Questo è il test che, come dicevo, funziona:
<?php
include 'test-read-antcud.php';
// Un uso possibile
// va definito $sito
// $sito = 'http://....'
// var_dump(estrai_mail(leggi_codice($sito)));
$elenco_mail = estrai_mail(leggi_codice($sito));
Leonardo
P.S. ma, per l'amor di Dio, valuta attentamente l'ipotesi di rivolgerti a uno sviluppatore Web.
Quel sito è un mucchio di pezzi di codice che funzionano per scommessa, e se per disgrazia
lo visita il piccolo Bobby Tables, lo asfalta e ne fa un parcheggio per camper :-(
--
A terrible beauty is born.
- W. B. Yeats, Easter 1916
Back to it.comp.www.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Ricerca email "infoannu" <22013invalid@mynewsgate.net> - 2016-10-25 07:50 +0000
Re: Ricerca email Leonardo Serni <lserni@gmail.com> - 2016-10-25 22:30 +0200
Re: Ricerca email "infoannu" <22013invalid@mynewsgate.net> - 2016-10-26 07:02 +0000
Re: Ricerca email Leonardo Serni <lserni@gmail.com> - 2016-10-26 14:55 +0200
Re: Ricerca email "infoannu" <22013invalid@mynewsgate.net> - 2016-10-26 13:23 +0000
Re: Ricerca email Alessandro Pellizzari <shuriken@amiran.it> - 2016-10-26 15:16 +0100
Re: Ricerca email Leonardo Serni <lserni@gmail.com> - 2016-10-26 19:10 +0200
Re: Ricerca email RedWiz <redwiz@inwind.it> - 2016-10-26 17:11 +0000
Re: Ricerca email "infoannu" <22013invalid@mynewsgate.net> - 2016-10-27 07:13 +0000
Re: Ricerca email Alessandro Pellizzari <shuriken@amiran.it> - 2016-10-27 10:28 +0100
Re: Ricerca email Leonardo Serni <lserni@gmail.com> - 2016-10-27 14:26 +0200
Re: Ricerca email M_M <spam@the.hell> - 2016-10-26 17:29 +0200
Re: Ricerca email M_M <spam@the.hell> - 2016-10-26 17:34 +0200
Re: Ricerca email "infoannu" <22013invalid@mynewsgate.net> - 2016-10-27 12:44 +0000
csiph-web