In this tutorials I will show you how to grab from MySpace: User default photo, Profile name, age, sex, location and link.
So lets start with the php to pull the info from MySpace. In this example i will be using a form to pull the user.
Get the source files: DOWNLOAD
See the DEMO
name this file “myspace.class.php”
//the function
function myspace(){
//keeps the page clear until the form is submitted.
if($_POST['submit']){
//Gets name or email from the form
$name = $_POST['name'];
//Gets the source code from the MySpace page
$source = implode(file("http://searchservice.myspace.com/index.cfm?fuseaction=sitesearch.results&type=People&qry=".$name.""));
//Look for
$search = '
';
//here is where we seperate everything from the page except the $search value
$newText = substr($source,strpos($source, $search)+strlen($search), 1000);
//if the user doesnt exist
$destroy = strip_tags($newText, '
');
//If the user doesnt exist it will print the doctype code, the code contains dtd
if(strstr($destroy, 'dtd')){
echo "
";
//if dtd is present lets make it say...
echo "".$_POST['name'].", Does not exist on MySpace";
echo "
";
}else{
echo "
";
}
}
}
next the form/results page
Add this under the form
include ('myspace.class.php');
myspace();
Now for style.css
body {
font-family:verdana,arial,helvetica,sans-serif;
font-size:11px;
}
.searchResults {
float:left;
width:auto;
}
.profilePhoto {
float:left;
overflow:hidden;
padding:13px 25px 13px 7px;
}
.userInfo {
float:left;
line-height:18px;
padding:10px 0;
}
.userInfo a {
font-size:12px;
text-decoration:underline;
}
.vanity {
color:#008800;
}
.profilePhoto img {
width:80px;
}
.pilRealName {
display:none;
}
.doIt {
display:none;
}
.exist {
padding:10px;
font-weight:bold;
}
img {
border:0 none;
}
Now run it, enter a username or email and grab some MySpace User Info. I use this on another site, using thier emails from the database to pull thier user info.
4 Responses to “Grab MySpace UserInfo”
Leave a Reply
Yeah, I will add the source files today sometime.
EDIT: Source added.
Would it be possible for you to make available source files?
I’m having trouble getting the script to run properly
im working on individual extraction. once thats done i will let you know.
Can you pls. help to extract name, sex, age and profile image individually ? Thanks.