Hello, does anyone have a stable code for this? I need it pretty soon, as my site is being promoted and my current code isn't so stable right now, meaning some of the users that join my site won't be displayed because my code didn't get their default correctly! Thanks.
This should work. <?php function grab_main_pic($url) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); if (preg_match('/<a\s+id="ctl00_Main_ctl00_UserBasicInformation1_hlDefaultImage"[^>]+><img\s+src="([^"]+)"/si', curl_exec($ch), $mainpic)) { return $mainpic[1]; } return 'Failed to grab main pic.'; } echo grab_main_pic('http://www.myspace.com/nicoswd'); ?> PHP: