-
MySpace Current Picture
I was like just messing around with PHP and explode etc and decided to make this script.
PHP Code:
<?php
function MySpacePicture($name){
$data = file_get_contents("http://myspace.com/".$name);
$linkstart = explode('<a id="ctl00_Main_ctl00_UserBasicInformation1_hlDefaultImage"', $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 Code:
<?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.
-
I just thought of doing that too :P
-
I dont know why I did, I never use MySpace
-
Hmm whats another site.. we could make something with...
-
Make it so you can get a msn picture lol
-
see if ya cn do summit with bebo
-
Im trying bebo now but i need thomas to help :P
-
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.
-
PHP Code:
<?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
-
I fixed your code and put it into a function :)
PHP Code:
<?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 Code:
<?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
-
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
-
Try again, I accidentally edited the bebo.php file.
EDIT
I made it so you can now just put the Bebo name in
PHP Code:
<?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 Code:
<?php
include('bebo.php');
echo '<img src="' . BeboPicture('Skulduggerybook') . '">';
?>