I am trying do download data from web with normall httpwebrequest (work on most url), but server send me unexpected response, like this
HTTP/1.1 200 OK Server: nginx Date: Thu, 10 Aug 2017 03:59:39 GMT Content-Type: application/json Content-Length: 1984 Connection: keep-alive Access-Control-Allow-Headers: Content-Type,Authorization,X-Requested-With,X-CSRFToken,If-None-Match-,X-API-SOURCE Vary: Accept-Encoding, Cookie ETag: "6f15f338d170c7f833c491beb546e4a9;gzip" Access-Control-Allow-Credentials: true Access-Control-Allow-Methods: POST,GET,OPTIONS,PUT,DELETE Set-Cookie: SPC_SI=ycl079eb0umjw270xoybjhok3hz6hp7x; expires=Fri, 11-Aug-2017 03:59:39 GMT; httponly; Max-Age=86400; Path=/
{
"itemid": 62790979,
"liked": false,
"offer_count": 0,
"videos": [],
"rating_star": 5.187136305269734,
"image": "6ebb860db6?????????????????????",
"image_list": ["6ebb860db6?????????????????????"],
"is_adult": null,
"can_use_wholesale": false,
"currency": "IDR",
"rcount_with_context": 6,
"show_free_shipping": 1,
"estimated_days": 3,
"show_discount": 0,
"price_before_discount": 0,
"cmt_count": 16,
"is_shopee_verified": false,
"catid": 202,
"is_official_shop": false,
"price_min": null,
"rating_count": [10, 0, 0, 2, 3, 5],
"liked_count": 13,
"version": "6f15f338d170c7f833c491beb546e4a9",
"coin_earn_items": [],
"price_min_before_discount": 0,
"cb_option": 0,
"price": null,
"hashtag_list": [
"#editin??????????????",
"#soft??????????",
"#sof?????????",
"#pal????????",
"#pal????????",
"#co??????",
"#co???????",
"#prog??????????",
"#juals????????????",
"#ins????????",
"#fl??????",
"#??",
"#pal????????",
"#u????"
],
"price_max": null,
"description": "Corel Draw Video X9 32 & 64 Bit\n2. Ulead VideoStudio v11 Plus\n3. Ulead VideoStudio v11 Plus\n4. Sony Ve?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????"
,
"flash_sale": null,
"models": [],
"brand": "",
"rcount_with_image": 1,
"shopid": 3732962,
"discount": null,
"has_lowest_price_guarantee": false,
"sold": 4,
"price_max_before_discount": 0,
"sub_catid": 443,
"condition": 1,
"name": "Packet????????????????????????",
"wholesale_tier_list": [],
"item_status": "no????",
"third_catid": 6910,
"is_pre_order": false,
"coin_spend_cash_unit": null,
"attributes": [],
"stock": 118
}
as you can see, some fields is combined with annoying "?" I check standar browser request using Fidler, the only thing different from my request is browser send "If-None-Match-" header to the server. question is how to fill that header, because I tried sent etag header from previous request but i still get response with "?" characters.
Hope you understand my poor language.
this is my code.
HttpWebRequest Web; HttpWebResponse Resp; StreamReader Reader; Web = (HttpWebRequest)WebRequest.Create(""https://shopee.co.id/api/v1/item_detail/?item_id=262740376&shop_id=13072340"); Web.CookieContainer = New CookieContainer(); Web.Method = "GET"; Web.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"; Web.KeepAlive = true; Web.Accept = "application/json"; Web.ContentType = "application/json; Charset=UTF-8"; Web.CachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.CacheIfAvailable); Web.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip; Web.Headers.Add("x-requested-with", "XMLHttpRequest"); Web.Headers.Add("x-api-source", "pc"); Resp = (HttpWebResponse)Web.GetResponse(); Reader = new StreamReader(Resp.GetResponseStream()); string Res = Reader.ReadToEnd();
this code work for first 5/6 request. after that, server will send annoying "?" like above..