<?php
//-----------------------------------------------------------------
// Include Class
//-----------------------------------------------------------------
include"myspace.php";
//-----------------------------------------------------------------
// Set Variables
//-----------------------------------------------------------------
if(!isset($_POST['myspace_url'])) $_POST['myspace_url'] = NULL;
if(!isset($layout)) $layout = NULL;
if(!isset($error)) $error = NULL;
//-----------------------------------------------------------------
// Do Action
//-----------------------------------------------------------------
if(isset($_POST['myspace_url']))
{
//-----------------------------------------------------------------
// Go and get
//-----------------------------------------------------------------
$profile = new MySpace("http://www.myspace.com/{$_POST['myspace_url']}");
//-----------------------------------------------------------------
// Profile Checks
//-----------------------------------------------------------------
if(!$_POST['myspace_url']) $error = 1;
elseif($profile->getMySpaceStatus() == 1) $error = 2;
elseif($profile->getMySpaceStatus() == 2) $error = 3;
else
{
//-----------------------------------------------------------------
// Output Layout
//-----------------------------------------------------------------
$layout .= "<div id='scrape'>";
$layout .= "<dl class='list'>";
$layout .= "<dt>Profile Version:</dt><dd>".$profile->getMyspaceProfileVersion().".0</dd>";
$layout .= "<dt>Status:</dt><dd>".$profile->getMySpaceStatus()."</dd>";
$layout .= "<dt>ID:</dt><dd>".$profile->getMySpaceUserID()."</dd>";
$layout .= "<dt>Name:</dt><dd>".$profile->getMySpaceName()."</dd>";
$layout .= "<dt>Full Name:</dt><dd>".$profile->getMySpaceFullName()."</dd>";
$layout .= "<dt>Sex:</dt><dd>".$profile->getMySpaceSex()."</dd>";
$layout .= "<dt>Age:</dt><dd>".$profile->getMySpaceAge()."</dd>";
$layout .= "<dt>Last Login:</dt><dd>".$profile->getMySpaceLastLogin()."</dd>";
$layout .= "<dt>Saying:</dt><dd>".$profile->getMySpaceSaying()."</dd>";
$layout .= "<dt>Mood:</dt><dd>".$profile->getMySpaceMood()."</dd>";
$layout .= "<dt>Friends Count:</dt><dd>".$profile->getMySpaceFriends()."</dd>";
$layout .= "<dt>Comments Count:</dt><dd>".$profile->getMySpaceCommentsCount()."</dd>";
$layout .= "<dt>Default Pic:</dt><dd>".$profile->getMySpaceDefaultPic()."</dd>";
$layout .= "<dt>URL:</dt><dd>".$profile->getMySpaceURL()."</dd>";
$layout .= "<dt>Location:</dt><dd>".$profile->getMySpaceLocation()."</dd>";
$layout .= "</dl>";
$layout .= "</div>";
}
}
//-----------------------------------------------------------------
// Define Error Messages
//-----------------------------------------------------------------
if($error == 1) { $status = "Myspace URL cannot be blank"; $color = "#ff0000"; }
elseif($error == 2) { $status = "Profile set to private"; $color = "#ff0000"; }
elseif($error == 3) { $status = "Invalid Friend ID"; $color = "#ff0000"; }
else { $status = "Enter Myspace Username"; $color = "green"; }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html lang="en" xml:lang="en">
<head>
<title>MySpace Content Grabber</title>
<meta http-equiv="Content-Type" content="txt/html; charset=utf-8" />
<style type="text/css">
* { margin: 0px; padding: 0px; }
body { padding: 0; font-family: verdana, arial, tahoma; color: #000; font-size: 0.8em; margin: 0; background: #fff; }
#form { width: 750px; padding: 5px; background: #eee; border: 1px solid #ccc; }
#form input.text { width: 400px; }
#wrapper { width: 750px; margin: 50px auto 0 auto; background-color: #fff; line-height: 1.2; }
#message { padding: 3px; width: 300px; color: <?= $color ?>; border: 1px solid #ccc; border-bottom: 0px; }
h2 { clear: both; border-bottom: 1px solid #000; padding: 2px; width: 760px; margin-bottom: 10px; }
#scrape dl.list { margin-top: 5px; margin-left: 20px;}
#scrape dl.list dt { font-weight: bold; margin: 0; margin-top: 2px; text-align: right; float: left; clear: both; margin-right: 10px; width: 140px; }
#scrape dl.list dd { font-weight: normal; margin: 0; margin-top: 2px; padding: 0 0 .5em 0; float: left; text-align: left; width: 410px; }
</style>
</head>
<body>
<!-- Wrapper -->
<div id="wrapper">
<h2>Myspace Content Grabber</h2>
<div id="message">
<p><?= $status ?></p>
</div>
<div id="form">
<form action='example.php' method='post'>
<input type='text' name='myspace_url' value='<?= $_POST['myspace_url'] ?>' class='text' />
<input type='submit' name='submit' value='Scrape User' />
</form>
</div>
<?= $layout ?>
</div>
<!-- /Wrapper -->
</body>
</html>
|