简体   繁体   English

从电子邮件地址获得大学

[英]Getting University from Email Address

Basically what I am trying to accomplish is trying to take one's email address say JoeRandom@harvard.edu and try to get what school they goto from it (In this case Harvard University would be returned). 基本上,我要完成的工作是尝试用一个电子邮件地址说JoeRandom@harvard.edu并尝试从中获得他们所要学习的学校(在这种情况下,哈佛大学将被退回)。 I was wondering if there is some sort of database somewhere that could be used to check the domain. 我想知道是否有某种数据库可以用来检查域。 Basically just cross checking the domain to see what school it belongs to. 基本上,只需交叉检查域即可查看其所属的学校。

Worst case scenario, I could check against other users in my database with that domain and what school they goto but that would require the first user registering with that domain to enter their University. 最坏的情况是,我可以检查数据库中具有该域的其他用户以及他们去的学校,但这将要求第一个在该域注册的用户进入他们的大学。

Hay if you wanted you could try and put the data out of a site like http://www.topuniversities.com/ . 如果需要,可以使用Hay,可以尝试将数据放出http://www.topuniversities.com/之类的网站 It has all the contact info for all the universities in the word. 它包含单词中所有大学的所有联系信息。

Here you go. 干得好。 All working and ready to go. 所有工作都准备就绪。 Validates your emails. 验证您的电子邮件。

<?php

$email = 'someone@harvard.edu';
$domain = substr( $email, strpos( $email, '@' )+1, strlen( $email ) );
$school = substr ( $domain, 0, strpos( $domain, '.' ) );

echo '<p>' . $domain . ': <b>' . ucwords( $school ) . '</b></p>';

preg_match_all( '/\((.*)\)/', strip_tags( file_get_contents( 'http://doors.stanford.edu/universities.html' ) ), $unilist );
$unilist = $unilist[1];

if ( in_array( $domain, $unilist ) ) {

    echo '<p>This is a verified domain!</p>';

}

?>

http://jordan.rave5.com/email.php http://jordan.rave5.com/email.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM