Exporting Rennies Value?

Discuss all kinds of software here including apps, games and operating systems. You can also share software guides and receive help for your software in this section.
User avatar
EmberCelica
Engineer
Engineer
CPU: i7 6700k
RAM: 16GB DDR4
Motherboard: [Unknown]
GPU: AMD RX480
Cooling: Fan Cooling
Location: Always behind you
Posts: 188
Joined: Sat Feb 28, 2015 11:20 pm

Exporting Rennies Value?

Fri Dec 04, 2015 6:41 am

Okay, so i was wondering if there was a way to have it in a script, or such, a script that would fetch our rennies value from the database/server/webpage and then be able to store it somewhere? Like say a MySql server for example. It would be nice to do that but im not even sure where to begin, let alone if know if that was okay to do in the firstplace.
Thanks in advance for any help or clarification
Image
Image Im the engineer of engineers.
Check out my redstone info thread
User avatar
Pri
Site Admin
Site Admin
Posts: 5433
Joined: Fri Dec 14, 2007 8:59 am

Re: Exporting Rennies Value?

Fri Dec 04, 2015 8:43 pm

You can get your rennie amount from this script which is mirrored on most of our pages (shop, auctions, voting etc)

http://vote.renmx.com/Rennie.amount.php

It requires your player username and authentication hash to be sent via cookie. The values are called ULaccount and ULkey. If you visit that page in your web browser and then view your cookies you'll find the values for these cookies and you can then pass them to the page with an automated program for example PHP, Perl, Java etc
User avatar
EmberCelica
Engineer
Engineer
CPU: i7 6700k
RAM: 16GB DDR4
Motherboard: [Unknown]
GPU: AMD RX480
Cooling: Fan Cooling
Location: Always behind you
Posts: 188
Joined: Sat Feb 28, 2015 11:20 pm

Re: Exporting Rennies Value?

Sun Dec 06, 2015 5:49 am

Thank you Pri for giving me a starting place, and Jack for assisting me in the code. Now it is complete:

Code: Select all

function getRennieAmount()
  //Replace '#<text>' with header!
  var rennieurl = "http://shop.renmx.com/Rennie.amount.php"
  var spreadsheeturl = "InsertSpreadSheetUrlHere"
  //Open up your spreadsheet and just copy the url, if you dont have one then create one and copy the url
  var options = 
      {
        //"method" : "post",
        "headers" : {"Content-Type" : "application/x-www-form-urlencoded", "Cookie": "#__cfduidNumberHere; ULaccount=#ULname; ULkey=#ULNumber; PHPSESSID=#SessionId;"},
      };
      //Where it says #__cfduid just copy the number and paste it, dont leave the __cfduid
  var response = UrlFetchApp.fetch(rennieurl,options);
  //This is where it actually retrieves the rennie value 
  var amount = response.getContentText("UTF-8");
  //This changes the value to UTF-8 for the spreadsheet.
  var date = Utilities.formatDate(new Date(),"GMT-6","MM-dd-YYYY")
  //Creates a new date with the date being today.
  var sheet=SpreadsheetApp.openByUrl(spreadsheeturl)
  //Targets the spreadsheet you specified earlier and 'opens' it
  sheet.setActiveSelection("A1")
  //Above sets the selection to A1 so that it continually places the new values on top.
 sheet.appendRow([date,amount]);
 //The above can be manpulated with more ,Variable or ,"Text" to add more columns.
 //This marks the end of the actual code that does things. the rest just logs it in the script program for testing purposes.
  Logger.log(response);
  Logger.log(date)
}
I decided to post my end product here incase others wanted to do this, of course, you can always just add more features and such or expand your knowledge to do other things. This is just what i did, if someone wants to take my code and improve upon it then please do so.
Hope this helps, and that i am not breaking any rules or such with this.
Image
Image Im the engineer of engineers.
Check out my redstone info thread

Return to “Software Centre”

Who is online

Users browsing this forum: No registered users and 6 guests