vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Using MySpace Default as Profile Picture (https://vborg.vbsupport.ru/showthread.php?t=176083)

Conner85 04-14-2008 08:39 AM

Using MySpace Default as Profile Picture
 
I've been searching aimlessly to find a way to link the default picture on MySpace to the profile picture area in my users' profiles. Pretty much all they have to do is type in their MySpace user name and their default picture shows up. As well as auto-updating every time they change their default picture on MySpace. I finally came across PHP code, but I have NO CLUE how to turn it into a plugin. If anyone could help, it would be awesome.

Code:

<?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/$userinfo[field24]');


?>


Conner85 04-16-2008 12:49 PM

Not meaning to bump.. but.. no one at all?

MoT3rror 04-16-2008 07:46 PM

If you want to show the myspace profile picture on everypage for the user signed in.

Hook: global_start

PHP Code:

function grab_main_pic($url)
{
    
$ch curl_init($url);
    
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
   
    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.';
}


$myspaceimage =  grab_main_pic('http://www.myspace.com/' $vbulletin->userinfo['field24']); 

Then in your template the variable $myspaceimage will include what your function is returning.

Also single and double quotes mean different things.
PHP Code:

$variable 1;
echo 
'$varaible'//will return $variable
echo "$variable"//will return 1 


Conner85 04-16-2008 09:16 PM

That seems to atleast get the plugin to respond. The way I was setting the plugin up was causing a bunch of errors. But now all it says is Failed to grab main pic. Is there anything I'm doing wrong?

By the way, thank you very much.

SEOvB 04-16-2008 09:31 PM

make sure curl is intalled and compiled on your server

Conner85 04-16-2008 09:35 PM

It's installed. Is there anything else it could be?

Conner85 04-17-2008 10:48 PM

Hmmmm.. Still saying Failed to grab main pic. Maybe the link needs to be changed into something like images.myspace.com? I've been trying to play around with it all I can. But as always, failed attempts.


All times are GMT. The time now is 08:32 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01074 seconds
  • Memory Usage 1,727KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete