Created
March 23, 2019 05:01
-
-
Save ejcx/0c08a2f497768e8ed12e1addbcd54def to your computer and use it in GitHub Desktop.
Flight Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"log" | |
"net/http" | |
"time" | |
) | |
var ( | |
d []byte | |
) | |
func main() { | |
go func() { | |
for { | |
resp, err := http.Get("https://www.unitedwifi.com/portal/r/getAllSessionData") | |
if err != nil { | |
log.Println(err) | |
continue | |
} | |
buf, err := ioutil.ReadAll(resp.Body) | |
if err != nil { | |
log.Println(err) | |
continue | |
} | |
d = buf | |
time.Sleep(time.Second * 5) | |
} | |
}() | |
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { | |
fmt.Fprintf(w, "%s", d) | |
}) | |
log.Fatal(http.ListenAndServe(":8080", nil)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@mattKaczorowsk I was actually able to pull an example response out of my chrome cache. Here it is: