Log in

View Full Version : MySpace Current Picture



ZAG
16-02-2007, 08:11 PM
I was like just messing around with PHP and explode etc and decided to make this script.



<?php
function MySpacePicture($name){

$data = file_get_contents("http://myspace.com/".$name);

$linkstart = explode('<a id="ctl00_Main_ctl00_UserBasicInformation1_hlDefaultIm age"', $data);
$linkend = explode('</a>', $linkstart[1]);
$link = trim($linkend[0]);

$imagestart = explode('<img src="', $link);
$imageend = explode('" border="0" />', $imagestart[1]);
$image = trim($imageend[0]);

return $image;

}

?>

It just gets the current picture for the given MySpace account.

Here is an example of using it with The Fratellis' MySpace. Lets say you saved the code in myspace.php



<?php
include('myspace.php');
echo '<img src="' . MySpacePicture("littlebabyfratelli") . '">';
?>


http://thomas.uk.to/myspace.php

I dont know why I created this, probably because I never know what to make.

Dentafrice1
16-02-2007, 08:17 PM
I just thought of doing that too :P

ZAG
16-02-2007, 08:18 PM
I dont know why I did, I never use MySpace

Dentafrice1
16-02-2007, 08:25 PM
Hmm whats another site.. we could make something with...

Blob
16-02-2007, 08:29 PM
Make it so you can get a msn picture lol

SAMURAl555
17-02-2007, 02:35 PM
see if ya cn do summit with bebo

Dentafrice1
17-02-2007, 03:18 PM
Im trying bebo now but i need thomas to help :P

ZAG
17-02-2007, 03:28 PM
Yeah i was looking at Bebo, but I couldnt find anything 'unique' that surrounds the profile image if you get what I mean.
EDIT:// Actually, I have just found something.

Dentafrice1
17-02-2007, 03:29 PM
<?php
$name = "1447801758";
$data = file_get_contents("http://www.bebo.com/Profile.jsp?MemberId=".$name);


$album = "PhotoAlbums.jsp?ProfilePhoto=Y&MemberId=".$name."";
echo $album;
$linkstart = explode('<a href=$album>', $data);
$linkend = explode('</a>', $linkstart[0]);
$link = trim($linkend[0]);

echo $link;

?>


Ive got it to give the link in between the <a href= but i cant get the damn <img src

ZAG
17-02-2007, 03:45 PM
I fixed your code and put it into a function :)



<?php
function BeboPicture($memberid){
$data = file_get_contents("http://www.bebo.com/Profile.jsp?MemberId=".$memberid);

$imagestart = explode('<a href=PhotoAlbums.jsp?ProfilePhoto=Y&MemberId='.$memberid.'><img src=', $data);
$imageend = explode(' border=0', $imagestart[1]);
$image = trim($imageend[0]);

return $image;
}
?> You would use it like


<?php
include('bebo.php'); //Lets say you saved the code in bebo.php
echo '<img src="' . BeboPicture(1447801758) . '">';
?>
Heres an example:

http://thomas.uk.to/bebo.php?id=1447801758 (http://thomas.uk.to/bebo.php?id=1447801758)

Dentafrice1
17-02-2007, 03:49 PM
Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home2/thomas/public_html/bebo.php on line 3

Warning: file_get_contents(http://.bebo.com) [function.file-get-contents]: failed to open stream: Permission denied in /home2/thomas/public_html/bebo.php on line 3

ZAG
17-02-2007, 03:51 PM
Try again, I accidentally edited the bebo.php file.

EDIT

I made it so you can now just put the Bebo name in


<?php
function BeboPicture($memberid){

$data = file_get_contents("http://".$memberid.".bebo.com");

$profileidstart = explode('<a href=/Profile.jsp?MemberId=', $data);
$profileidend = explode(' class=profile_tab_active', $profileidstart[1]);
$profileid = trim($profileidend[0]);

$imagestart = explode('<a href=PhotoAlbums.jsp?ProfilePhoto=Y&MemberId='.$profileid.'><img src=', $data);
$imageend = explode(' border=0', $imagestart[1]);
$image = trim($imageend[0]);

return $image;
}
?>

Used like:


<?php
include('bebo.php');
echo '<img src="' . BeboPicture('Skulduggerybook') . '">';
?>

Want to hide these adverts? Register an account for free!