Golang net/http.Request.ParseForm() function example

package net/http

Golang net/http.Request.ParseForm() function usage example

  func IPN(w http.ResponseWriter, r *http.Request) {

 fmt.Println("IPN received from PayPal")

 err := r.ParseForm() // need this to get PayPal's HTTP POST of IPN data

 if err != nil {
 fmt.Println(err)
 return
 }

 if r.Method == "POST" {
 ...

see full example at : https://www.socketloop.com/tutorials/golang-interfacing-with-paypal-s-ipn-instant-payment-notification-example

References :

http://golang.org/pkg/net/http/#Request.ParseForm

https://www.socketloop.com/tutorials/golang-interfacing-with-paypal-s-ipn-instant-payment-notification-example

Advertisement