Long story short , here's my listener:
My PHP file:
Basically , what I need to do is output the content of this link: http://steamrep.com/api/beta/reputation/76561197971691194?json=1 in message_user_info.
Can anyone help?
PHP:
<?php
class Steamrep_Rep_Rep {
public static function includePhpFile($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
{
if($hookName == 'message_user_info_avatar')
{
ob_start();
require_once('repchecker.php');
$contents .= ob_get_contents();
ob_end_clean();
$hookParams['rep'] = $rep;
$params = $template->getParams();
$params += $hookParams;
}
}
}
?>
PHP:
<?php
class Steam_Rep_Rep {
// cURL Variable
private $ch = null;
public function __construct() {
// Setup cURL
$this->ch = curl_init();
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($this->ch, CURLOPT_TIMEOUT, 4);
}
public function getUserInfo($steamrep_id) {
// cURL
curl_setopt($this->ch, CURLOPT_URL, "http://steamrep.com/api/beta/reputation/76561197971691194?json=1");
$result = curl_exec($this->ch);
$xml = json_decode($result);
if(!empty($xml->steamrep->reputation)) {
return array(
'rep' => $xml->steamrep->reputation,
);
} else {
return array(
'rep' => "No reputation found",
);
}
}
}
$steam = new Steam_Rep_Rep();
$rep = $steam->getUserInfo('76561197971691194');
?>
Can anyone help?