-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
82 lines (67 loc) · 1.67 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package main
import (
"code.google.com/p/go.net/publicsuffix"
"io/ioutil"
"log"
"net/http"
"net/http/cookiejar"
"net/url"
)
const (
loginUrl = "http://elas.las.vsbnet.be/postlogin.php"
transactionUrl = "http://elas.las.vsbnet.be/transactions/posttransaction.php"
)
type ElasMember struct{
}
type ElasGateway struct{
baseUrl String,
client http.Client,
dataAdapter
}
func (this *ElasGateway) members() ElasMember[]{
}
type MembersRepository struct{
}
func main() {
options := cookiejar.Options{
PublicSuffixList: publicsuffix.List,
}
jar, err := cookiejar.New(&options)
if err != nil {
log.Fatal(err)
}
proxyUrl, err := url.Parse("http://amarisadsl:3128")
client := &http.Client{Transport: &http.Transport{Proxy: http.ProxyURL(proxyUrl)}, Jar: jar}
login(client)
// makeTransaction(client)
}
func makeTransaction(client *http.Client){
values := url.Values{}
values.Set("letsgroup", "1")
values.Set("letscode_from", "140")
values.Set("letscode_to", "138")
values.Set("amount", "1")
values.Set("minlimit", "-500")
values.Set("balance", "500")
values.Set("description", "automatische test")
resp, err := client.PostForm(transactionUrl, values)
printBody(resp, err)
}
func login(client *http.Client){
values := url.Values{}
values.Set("login", "[email protected]")
values.Set("password", "Wortel7")
resp, err := client.PostForm(loginUrl, values)
printBody(resp, err)
}
func printBody(resp *http.Response, e error){
if e != nil {
log.Fatal(e)
}
data, err := ioutil.ReadAll(resp.Body)
resp.Body.Close()
if err != nil {
log.Fatal(err)
}
log.Println(string(data))
}