Reply
Grabbing MySpace picture URLs, with PHP Regex, not working correctly.
Old 11-02-2009, 09:58 AM Grabbing MySpace picture URLs, with PHP Regex, not working correctly.
Junior Talker

Posts: 1
Name: bob
Trades: 0
On 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;

Code:
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>
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 is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 11-02-2009, 11:28 PM Re: Grabbing MySpace picture URLs, with PHP Regex, not working correctly.
rednimaT's Avatar
Skilled Talker

Posts: 65
Name: Taminder B.
Location: San Jose, CA
Trades: 0
I havn't looked at the code, but seeing as how MySpace might have updated its photo system, you should check how it scrapes the friend ID. make sure you can find the code from your script in the HTML source code of the profile page. also your script seems too complicated for such a simple task.
__________________
NRG Lab - Web Design Services & Resources
(HTML/PHP/MySQL/JavaScript/AJAX/SEO)
rednimaT is offline
Reply With Quote
View Public Profile Visit rednimaT's homepage!
 
Reply     « Reply to Grabbing MySpace picture URLs, with PHP Regex, not working correctly.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.18273 seconds with 13 queries