Jump to content

Recommended Posts

Hey, Im rather new with PHP and I was just wondering how it would be possible to scrape the Display name of a myspace.com user?

What I'm after is a form that, when given a User ID from myspace, it will search their page and find out their display name is, and then display it.

 

My friend has written me a code to find out the default image of a user and that seems to work perfectly.

 

This is what he gave me.

 

index.php

<form method="post" action="index2.php">

Enter Your Friend ID To Continue:<br>

<input name="friendid" id="friendid" maxLength="10"><br>

<input type="submit" value="Login">

</form>

 

index2.php

<?php

$friendid= $_POST['friendid']; //member id

$url="http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=$friendid";

$t = join("",file("$url"));

 

$picid = '/ctl00_Main_ctl00_UserBasicInformation1_hlDefaultImage" .*?"><img src="(.*?)"/';

 

$t = ereg_replace("\n", "", $t);

preg_match_all($picid, $t, $m);

 

 

$img=$m[1][0];

echo "<img src='$img'>";

?>

 

I've tried altering bits and pieces of the code myself, and so far i've failed every time.

 

All I know is the Display name is in this code.

 

Quote:

<span class="nametext">Display Name Goes Here</span> 

 

Can someone help me alter this code so it will find out BOTH the display name, and default image of a user?

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/53157-scraping-from-a-website/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.