Build your own Penn State community site using Dapper

It has been an observation of mine that some of the best online communities are the ones that most effectively mimic offline communities. Take Facebook for example. In my opinion, Facebook owes much of its success to its members’ use of real names. My news feed doesn’t say “OgReSLAYER91 is friends with Xx1337haXzorxX.” Instead, it could say “Steve Ballmer is friends with Bill Gates.” This adds tremendous value to a social network. To tap into this value, many developers turn to the Facebook API. Sometimes it makes no sense to start a social network from scratch. However, for Penn State-oriented developers, there is a decent alternative.

Penn State has an online directory, psu.edu/ph, where anyone can enter information about a student or faculty member at Penn State and find out information such as their full name, major, address, and a few other bits of miscellany. Using Dapper, I made a script which outputs a Penn State student’s or faculty member’s full name given their user id.

So a Penn State-oriented community site or social network would accept only those with a “userid”@psu.edu email address. Here’s a little proof of concept script to get started:

< ?php
$userid = explode("@", $_GET[userid]); //user inputs email address
$domains = explode(".", $userid[1]);
if ($domains[0] !== "psu"){ //checks for psu domain
echo "
 
Sorry, we are only accepting registration from Penn State students.";
}else{
$xml = simplexml_load_file("http://www.dapper.net/RunDapp?dappName=psuph&v=1&v_userid=".$userid[0].""); //runs my dapp
$name = $xml->name;
$pieces = explode(" ", $name);
function uppercase($string){
$string = ucfirst(strtolower($string)); //converts all uppercase names to only first letter uppercased
echo $string;
}
echo "
 
Welcome, ";
uppercase($pieces[0]); //outputs first name
echo " ";
uppercase($pieces[1]); //outputs middle name
echo " ";
uppercase($pieces[2]); //outputs last name
echo "!
 
<em>a confirmation code has been sent to ".$_GET[userid]."</em>
 
";
}
?&gt;

The script accepts an email address then checks if it’s from Penn State. If it is from Penn State, the script (via Dapper) scrapes the person’s name from Penn State’s ph server, parses some xml and then outputs a nicely formatted name.

I’ve been playing around with this Dapp, trying to have it collect other data, such as addresses, but it is much less accurate.

I’d like to get a flash widget of this Dapp up, but have thus far experienced some difficulty. Until then, you can run the actual script here. Feel free to change the userid in the address bar of your browser to test it out yourself.

Post a Comment

Your email is never published nor shared. Required fields are marked *