Results 1 to 7 of 7

Thread: How to send grand exchange data to a web server?

  1. #1
    Join Date
    Jun 2015
    Location
    New Zealand
    Posts
    322
    Mentioned
    2 Post(s)
    Quoted
    131 Post(s)

    Default How to send grand exchange data to a web server?

    Hi Guys,

    I'd like to be able to send my grand exchange transactions to a web server, that stores the information in a table and/or database. Could you please let me know if this is possible? Thanks

  2. #2
    Join Date
    Jul 2015
    Posts
    80
    Mentioned
    1 Post(s)
    Quoted
    22 Post(s)

    Default

    It could be done with MYSQL, there is tutorial on forums, you could modify it as you need.

  3. #3
    Join Date
    Dec 2013
    Location
    Pitcairn Island
    Posts
    288
    Mentioned
    20 Post(s)
    Quoted
    166 Post(s)

    Default

    Quote Originally Posted by kiwikiwi View Post
    Hi Guys,

    I'd like to be able to send my grand exchange transactions to a web server, that stores the information in a table and/or database. Could you please let me know if this is possible? Thanks
    As others said you can use something like this.

    Your simba function might look like:

    Simba Code:
    function SendData(Item: String; Buy: Boolean; Price: Integer; Amount: Integer): Boolean;
    var
      c: Integer;
    begin
      c := InitializeHTTPClient(False);

      AddPostVariable(c, 'Item', Item;
      AddPostVariable(c, 'Buy', BoolToStr(Buy));
      AddPostVariable(c, 'Price', IntToStr(Price));
      AddPostVariable(c, 'Amount', IntToStr(Amount));

      Result := (pos('true', PostHTTPPageEx(c, 'http://someaddress.net/trades.php')) <> 0);

      FreeHTTPClient(c);
    end;

    begin
      if SendData('Feather', True, 10, 20000) then
        WriteLn('Sent transaction to server');
    end.

    And your trades.php file you dump on your webserver might look like:

    PHP Code:
    <?PHP
    /*
      This file does the following:
        o Receives a POST request from Simba
        o Connects to your SQL database
        o Adds a new row to the database table

    */
      # Server login information
      
    $user_name "xx";  
      
    $pass_word "xx";  
      
    $database  "xx";  
      
    $server    "xx";

      
    # Assigning values received from Simba to PHP variables
      
    $item_name  $_POST['Item'];
      
    $trans_type $_POST['Buy'];
      
    $price      $_POST['Price'];
      
    $quantity   $_POST['Amount'];

      
    # Connecting to SQL database
      
    $db_handle mysql_connect($server$user_name$pass_word); 
      
    $db_found mysql_select_db($database$db_handle);  

      if (
    $db_found){ 
            
        
    # Building a query to insert values as a new row into a table called "TradeTable"
        
    $query "INSERT INTO TradeTable (Date, Time, Item, Type, Price, Amount)
          VALUES(
            DATE(NOW()),
            TIME(NOW()),
            '"
    .$item_name."',
            '"
    .$trans_type."',
            '"
    .$price."',
            '"
    .$quantity."')";
                        
        
    $result mysql_query($query);
                
        
    # This php file will return a string (which you can see is utilised by the method in simba)
        
    if ($result
          print 
    "true";
        else
          print 
    "talse";
                
      }else 
        print 
    "Database not found";  
    ?>

  4. #4
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Meh to php. Stand up a flask server with a endpoint that takes a json payload. Then just push that data into whatever database you want.

  5. #5
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    Quote Originally Posted by tls View Post
    Meh to php. Stand up a flask server with a endpoint that takes a json payload. Then just push that data into whatever database you want.
    Ah yes, of course! The easy option (I HAVE NO IDEA WHAT THIS MEANS)

    With Simba, the tried and true option (with tutorials available) is using PHP as Laquisha mentioned. I'd suggest just going with that unless there's a benefit to using flask (I used google for 5 minutes and realized I have no understanding of flask).

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

  6. #6
    Join Date
    Dec 2013
    Location
    Pitcairn Island
    Posts
    288
    Mentioned
    20 Post(s)
    Quoted
    166 Post(s)

    Default

    Quote Originally Posted by 3Garrett3 View Post
    Ah yes, of course!
    Classic tls; Big talk No code.

  7. #7
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Quote Originally Posted by Laquisha View Post
    Classic tls; Big talk No code.
    Lol. Flask is probably the most used web server framework for python besides django. I'm not going to spend the time to code his project for him, especially when its incredibly easy to google any question related to flask. Spoonfeeding code doesn't teach anyone.

    Quote Originally Posted by 3Garrett3 View Post
    Ah yes, of course! The easy option (I HAVE NO IDEA WHAT THIS MEANS)

    With Simba, the tried and true option (with tutorials available) is using PHP as Laquisha mentioned. I'd suggest just going with that unless there's a benefit to using flask (I used google for 5 minutes and realized I have no understanding of flask).
    Python is a much better language to use and is definitely "tried and true", but if you want something that *just works* with the least amount of effort then go ahead. Python is a very pleasant language to build small systems like this, and I would suggest looking into learning the basics. When you learn enough you can whip up simple scripts to do anything you want and there is a massive package ecosystem for essentially everything you can think of.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •