GM2 getting HTML/HTTP information on a website

Discussion in 'Programming' started by Drturtlebot, Aug 28, 2019.

  1. Drturtlebot

    Drturtlebot Member

    Joined:
    Jun 22, 2019
    Posts:
    3
    Hello, I am currently working on a game which requires it to know if the stock market is currently open or not, It needs to go to https://www.stockmarketclock.com/exchanges/nyse/trading-hours and check if the Exchange is open or closed. Iv seen that this may be possible with http_Get but i have no idea where to go, any ideas?
     
  2. chamaeleon

    chamaeleon Member

    Joined:
    Jun 21, 2016
    Posts:
    1,063
    Use the API provided (https://www.stockmarketclock.com/pricing, https://www.stockmarketclock.com/api-documentation.html#stockmarketclock-api), as querying the website would presumably get your game blocked if the abuse is detected. And needless to say, given that the API is not free and requires a key, you should use as server of your own that query the API, instead of embedding the key in your game so that anyone can pick it out and use the API while you pay for it.
     
  3. Homunculus

    Homunculus Member

    Joined:
    Jun 20, 2016
    Posts:
    853
    Opening hours and days are set, why do you need to get this information live from the website to begin with?

    With http_get you can download the html code of the page, but seeing how the clock works, it probably won't be of any help since that is probably dynamically generated with JS.

    A better solution (other than hardcoding the opening hours) is to use an API as @chamaeleon suggested.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice