Log in

View Full Version : Steam Avatar


Deep-X
08-09-2010, 05:19 AM
I dont know much of php / xml

But after reviewing some forums that I see that private users are able to "get" information from Steam/Valve, communities / profiles.

This is the function that I have so far

"field7" is actually the Steam Profile link such as

http://www.noobsticks.com/home.php?pageid=lookup




<!-- Steam Avatar hack -->
<if condition="$post['field7']">
<a href=http://steamcommunity.com/profiles/$post[field7]>
<img src="$post['field7']_medium.jpg" align="center" width="254" height="48" scrolling="no" marginheight="0" marginwidth="0" frameborder="0"></a>
</if>
<!-- Steam Avatar hack -->


This is my Steam profile

http://steamcommunity.com/profiles/$post['field7']/?xml=1

http://steamcommunity.com/profiles/76561197964246361/?xml=1

http://media.steampowered.com/steamcommunity/public/images/avatars/f2/f2a6ad2b7f7c7feb43e237b66e6838034640ad0b_medium.jp g

How do I get this link which is the <avatarMedium><![CDATA[http://media.steampowered.com/steamcommunity/public/images/avatars/f2/f2a6ad2b7f7c7feb43e237b66e6838034640ad0b_medium.jp g]]></avatarMedium>

Sounds all confusing to myself.

Here is a external link for help this would be a great mod for many of our communities are based off of Steam.

--------------- Added 1281344926 at 1281344926 ---------------

actually found some code that works with this


if (($p1=strpos($data,'<div class="avatarFull">'))!==false){
$p1=strpos($data,'<',$p1+24);
$p2=strpos($data,'>',$p1+1);
$tmp=substr($data,$p1,$p2-$p1+1);
$link_full=get_link_src($tmp);
download($link_full,'/folder/where/avatars/should/be/stored/prefix_full'.$ret['uid'].'.jpg');
$ret['img_full']=$tmp;

$tmp=str_replace('_full','',$tmp);
$link_small=get_link_src($tmp);
download($link_small,'/folder/where/avatars/should/be/stored/prefix_small'.$ret['uid'].'.jpg');
$ret['img_small']=$tmp;
}

function get_link_src($data){
$p1=strpos($data,chr(34));
$p2=strpos($data,chr(34),$p1+1);
return substr($data,$p1+1,$p2-$p1-1);
}

function download ($url,$target){
$data=file_get_contents($url);
if ($data) {
file_put_contents($target,$data);
}
}