thucha1391
Members-
Số lượng nội dung
4 -
Đã tham gia
-
Lần ghé thăm cuối
Cộng đồng
1 NeutralKhách vừa ghé thăm
Khách vừa ghé thăm đã bị tắt và không được hiển thị tới những người dùng khác.
-
thucha1391 đã bắt đầu đang theo dõi Gửi chat trên Shopee
-
private void Send_Chat(object sender, RoutedEventArgs e) { LoginShopee(); http.AllowAutoRedirect = true; http.IgnoreProtocolErrors = true; http.AddHeader(":authority", "banhang.shopee.vn"); http.AddHeader(":method", "POST"); http.AddHeader(":path", "/webchat/api/v1.2/messages?_uid=0-302890341&_v=6.1.1"); http.AddHeader(":scheme", "https"); http.AddHeader("accept", "*/*"); http.AddHeader("accept-language", "vi-VN,vi;q=0.9,fr-FR;q=0.8,fr;q=0.7,en-US;q=0.6,en;q=0.5"); http.AddHeader("x-api-source", "pc"); http.AddHeader("origin", "https://banhang.shopee.vn"); http.AddHeader("x-requested-with", "XMLHttpRequest"); http.AddHeader("authorization", "Bearer "+token); http.Referer = "https://banhang.shopee.vn/webchat/conversations"; string dataj = @"{""request_id"":""abc"",""to_id"":64210926,""type"":""text"",""content"":{""text"":""alo""},""chat_send_option"":{""force_send_cancel_order_warning"":false,""comply_cancel_order_warning"":false},""device_id"":""def""}"; HttpContent datasend = new StringContent(dataj); string main_html = http.Raw(xNet.HttpMethod.POST, "https://banhang.shopee.vn/webchat/api/v1.2/messages?_uid=0-302890341&_v=6.0.3", datasend).ToString(); MessageBox.Show(main_html); } Em đang làm code c# gửi tin nhắn trên Shopee, kết quả không gửi đc trả về null, không biết cái request_id và device_id được sinh ra ở đâu, bác nào cứu giúp e với!
-
thucha1391 đã bắt đầu đang theo dõi QuangBlue
-
Có bác nào biết API Shopee lấy danh sách sản phẩm tương tự không nhỉ?
thucha1391 đã đăng một câu hỏi trong Hỏi đáp
Mình muốn lấy danh sách sản phẩm tương tự như link dưới, có API lấy không nhỉ? cảm ơn ạ https://shopee.vn/similar_products/156112/252553581/160?pageNumber=1 -
Mình Request API shopee link này thì có lúc trả về trống, không báo lỗi gì, có lúc thì lại bình thường https://shopee.vn/api/v2/search_items/?by=relevancy&keyword=samsung%20a11&limit=50&newest=0&order=desc&page_type=search&version=2 Mình thử sửa link kia cho limit=1 thì lại luôn trả về đúng.
-
Mình muốn lấy dữ liệu liked từ API, đây là cách mình làm, nhưng luôn trả về false( đã login và like sản phẩm). Mong cao nhân chỉ giáo $curlObj = curl_init(); curl_setopt($curlObj, CURLOPT_URL, 'https://shopee.vn'); curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curlObj, CURLOPT_HEADER, 1); curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, false); $result = curl_exec($curlObj); preg_match_all('/^Set-Cookie:\s*([^;]*)/mi', $result, $match_found); $cookies = array(); foreach($match_found[1] as $item) { parse_str($item, $cookie); $cookies = array_merge($cookies, $cookie); } curl_close($curlObj); $url = 'https://shopee.vn/api/v2/item/get?shopid=302870756&itemid=5558354179'; $data_shopee = file_get_contents_ex($url, $cookies); $like_check = $data_shopee ['item']['liked']; echo $like_check // ccc function file_get_contents_ex($url, $cookie = null) { $opts = array( 'http' => array( 'method' => 'GET', 'user-agent'=> 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36', 'header' => (!empty($cookie) ? "Cookie: ".http_build_query($cookie, '', '; ')."\r\n" : ''), ) ); $context = stream_context_create($opts); $contents = file_get_contents($url, false, $context); $json_data = json_decode($contents, true); return $json_data; }