Grabbing MySpace picture URLs, with PHP Regex, not working correctly.

Discussion in 'PHP' started by do the sk8, Nov 2, 2009.

  1. #1
    n a MySpace script to grab picture and friend ID urls, everything is going fine, up to the picture URL grab, it's suppose to grab the current picture URL from the friend ID, to repost, using preg_match;

    
    define ("profile_url","http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendID=" );
    $full_file_path = profile_url.$fid;
    $handle = fopen($full_file_path,"r");
    	if (!$handle){
        	echo "<p>Sorry Myspace Is Slow Try Again.\n";
        	$arr = 0; }
    	else {
    	$timeout = 300;
    	ini_set('max_execution_time','120');
    	set_time_limit(120);
    	ini_set('default_socket_timeout','120');
    	while($contents = fread($handle,'1024'))
    	{ $hold .= $contents; }
    	preg_match("/<a id=\"ctl00_cpMain_ctl00_UserBasicInformation1_hlDefaultImage\" rel=\"searchMonkey-photo\" href=\"http:\/\/viewmorepics.myspace.com\/index\.cfm\?fuseaction=user\..*?friendID=$fid\">.*?<\s*img [^\>]*src=\"([^\">]+)/is",$hold,$match);
    	$pic_url = $match[1];
    preg_match("/<span class=\"nametext\">(.*)<br \/>/",$hold,$match);
    $name = $match[1];
    		if(empty($pic_url))
    		{
    		preg_match("/<a type=\"text\/javascript\" id=\"ctl00_cpMain_ctl00_UserBasicInformation1_hlDefaultImage\" rel=\"searchMonkey-photo\" href=\"http:\/\/viewmorepics.myspace.com\/index\.cfm\?fuseaction=user\..*?friendID=$fid\">.*?<\s*img [^\>]*src=\"([^\">]+)/is",$hold,$match);
    
    		$pic_url = $match[1];
    		}
    		if(empty($name))
    		{
    		preg_match("/<span class=\"nametext\">(.*)<\/span>/",$hold,$match);
    		$name = $match[1];
    		}
    		
    		fclose($handle);
    		ini_restore('max_execution_time');
    		ini_restore('default_socket_timeout');
    		if(empty($pic_url))
    		{ ?>
    <script language="javascript"><!--
    alert("Invalid ID!")
    location.replace("index.php")
    //-->
    </script>
    
    Code (markup):
    So basically, when the user submits their friend ID, I need it to grab the picture, which it doesn't and returns the alert "Invalid ID!".

    I've tried a few things, such as add user_set, and preg_match_all, any idea what it could be?
    Thanks
     
    do the sk8, Nov 2, 2009 IP
  2. do the sk8

    do the sk8 Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Nobody knows?
     
    do the sk8, Nov 2, 2009 IP