我在这个网站https://www.oneness287.com/collections/all/products/adidas-equipment-support-adv-4,我希望将该产品添加到我的购物车中。
我认为应该起作用的是(x =网站的网址)
resp,err := http.PostForm(x+"/cart/add",url.Values{"id":{"29709681417"}})
因为表单action =“/ cart / add”,而size的输入类型的名称为id。
但是之后的响应主体是
&{404 Not Found 404 HTTP/1.1 1 1 map[Date:[Tue, 24 Jan 2017 10:15:39 GMT] X-Dc:[ash,chi2] Content-Type:[text/html; charset=utf-8] Vary:[Accept-Encoding] X-Shardid:[8] X-Permitted-Cross-Domain-Policies:[none] X-Xss-Protection:[1; mode=block; report=/xss-report?source%5Baction%5D=not_found&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=storefront_section%2Fshop&source%5Bsection%5D=storefront&source%5Buuid%5D=66d12b35-aa92-4dea-8add-8fdf04609371] X-Request-Id:[66d12b35-aa92-4dea-8add-8fdf04609371] Connection:[keep-alive] X-Shopid:[1875180] Content-Language:[en] Cache-Control:[no-cache, no-store] Set-Cookie:[customer_sig=; path=/; expires=Sat, 24 Jan 2037 10:15:39 -0000; HttpOnly _session_id=a26d201e2649179d094c504c0edef003; path=/; HttpOnly cart_sig=; path=/; expires=Tue, 07 Feb 2017 10:15:39 -0000; HttpOnly] X-Content-Type-Options:[nosniff] X-Download-Options:[noopen] Server:[nginx]] 0xc042201060 -1 [chunked] false true map[] 0xc0420ae1e0 <nil>}
这样做的正确方法是什么?
答案 0 :(得分:0)
添加URI
与基地URL
x := "https://www.oneness287.com"
resp, err := http.PostForm(x+"/cart/add",url.Values{"id":{"29709681417"}})
返回200 OK