更多评论
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://www.sf-express.com/sf-service-core-web/service/waybillList/getPaginatedWaybillList?lang=sc&region=cn&translate=sc"
method := "POST"
payload := strings.NewReader(`{"pageNo":1,"pageSize":10,"condition":{"dataType":0,"supportWaybillStatusNew":true}}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Cookie", "i18n_redirected=sc; sensorsdata2015jssdkcross=%7B%22distinct_id%22%3A%2218bd33c485e75-0e3cf39fe213a2-26031051-2073600-18bd33c485f2aa%22%2C%22first_id%22%3A%22%22%2C%22props%22%3A%7B%7D%2C%22%24device_id%22%3A%2218bd33c485e75-0e3cf39fe213a2-26031051-2073600-18bd33c485f2aa%22%7D; tgw_l7_route=a730579da1dace945c7cb8269a8c9c1b; OWFSESSION=685b8a9c4539432f861780f4e52564a0; loginUser=; remember-me=ZmY5ZTRkNmVmZTAzNDA0ZWFjYTFiMDczY2FmYWQ1MDI6NDMwNDQwZGM4YWMxNDg1OWIwMGIzMmNkNzkyYmQyMzE=")
req.Header.Add("Content-Type", "application/json;charset=UTF-8")
req.Header.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36")
req.Header.Add("Sec-Ch-Ua-Platform", "Windows")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
#1