Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function Grab_Adventures($username){
- $url = 'http://services.runescape.com/m=adventurers-log/rssfeed?searchName=' . $username;
- $ch = curl_init($url);
- curl_setopt( $ch, CURLOPT_POST, false );
- curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );
- curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7");
- curl_setopt( $ch, CURLOPT_HEADER, false );
- curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
- $data = curl_exec($ch);
- $public = true;
- $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
- if($httpCode == 404) {
- $public = false;
- }
- if($public == true) {
- $x = new SimpleXmlElement($data);
- echo '<a target="_blank" href="' . 'http://services.runescape.com/m=adventurers-log/display_player_profile.ws?searchName=' . $username . '"><font size="1" color="#454545">View On Runescape</font></a>';
- echo '<div id="showalog" style="margin-top:20px;">
- <table align="center" id="user_stats_sort" class="tablesorter"><thead>
- <tr><th></th>
- <th width="150"></th>
- <th width="400"></th>
- <th width="90"></th></thead><tbody>';
- foreach($x->channel->item as $entry) {
- $entry_target = $entry->title;
- $entry_date = split('00', $entry->pubDate);
- $entry_description = $entry->description;
- $entry_image = Locate_Image($entry_description, $entry_target);
- echo '<tr align="left"><td><img src="' . $entry_image . '" width="15"></td><td><font size="1">' . $entry_target . '</font></td><td><font size="1">' . $entry_description. '</font></td><td align="right"><font size="1">' . $entry_date[0]. '</font></td></tr>';
- }
- echo '</tbody></table></div>';
- } else {
- echo '<font size="1">This user\'s Adventure\'s Log is private.</font>';
- }
- }
- function Locate_Image($description, $title) {
- $x = strtolower($description);
- $z = strtolower($title);
- if (strpos($x,'in all skills') !== false) {
- return 'images/overall_icon.png';
- }
- $skills = array('attack','defence','strength','constitution','ranged','prayer','magic','cooking','woodcutting','fletching','fishing','firemaking','crafting','smithing','mining','herblore','agility','thieving','slayer','farming','runecrafting','hunter','construction','summoning','dungeoneering','divination');
- foreach ($skills as &$y) {
- if (strpos($x,$y) !== false) {
- return 'images/' . $y .'_icon.png';
- }
- }
- if (strpos($x,'daemonheim') !== false) {
- return 'images/dungeoneering_icon.png';
- }
- if (strpos($x,'i caught') !== false) {
- return 'images/hunter_icon.png';
- }
- if (strpos($z,'thalassus') !== false) {
- return 'images/fishing_icon.png';
- }
- if (strpos($z,'quest') !== false) {
- return 'images/quest_icon.png';
- }
- if (strpos($x,'court summons') !== false) {
- return 'images/court_icon.png';
- }
- if (strpos($x,'i looted') !== false) {
- return 'images/inventory_icon.png';
- }
- if (strpos($x,'i found') !== false) {
- return 'images/inventory_icon.png';
- }
- if (strpos($x,'it dropped') !== false) {
- return 'images/inventory_icon.png';
- }
- return 'images/overall_icon.png';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment