This trivial code is not working...
if err != nil {
log.Println(err)
return
}
req.Header.Add("Accept", "text/html")
q := req.URL.Query()
q.Add("toga", strings.TrimSpace(strings.Split(msg, "~")[1]))
req.URL.RawQuery = q.Encode()
resp, err := client.Do(req)
if err != nil {
log.Println(err)
return
}
Sample input :
msg := "xml~1010"
Output :
Curl session:
* Trying x.y.z.w...
> GET /togx.php?toga=1010 HTTP/1.1
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Sat, 05 Dec 2015 12:50:54 GMT
< Server: Apache/2.2.27 (Unix) mod_ssl/2.2.27 OpenSSL/1.0.1e-fips mod_bwlimited/1.4
< X-Powered-By: PHP/5.4.29
< Connection: close
< Transfer-Encoding: chunked
< Content-Type: text/html