KeshHERE Posted February 17, 2018 Share Posted February 17, 2018 (edited) Here is the script I am using for getting response from below website. $loginurl ="http://mcqdb.com/api/problemaccess/GetAdaptiveNextProblem/?gradeId=PrePG&subjectId=Medicine" $login = ObjCreate("winhttp.winhttprequest.5.1") $login.Open("POST",$loginurl, False) $login.SetRequestHeader('User-Agent','Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0') $login.SetRequestHeader('Content-Type', 'application/json; charset=utf-8') $login.SetRequestHeader('Accept', 'application/json; charset=utf-8') $login.SetRequestHeader('Accept-Encoding', 'gzip, deflate') $login.SetRequestHeader('Accept-Language', 'en-US,en;q=0.5') $login.SetRequestHeader('Referer', 'http://mcqdb.com/') $login.SetRequestHeader('Content-Length', '2') $login.SetRequestHeader('Connection', 'close') $login.Send() MsgBox(0,'hi',$login.responseText) This request is going without a problem and returning needed response when i see it in WIRESHARK. But responseText does not seem to be what i want. Valid Response which I want is in JSON (As you can see in WIRESHARK) but it is not the case with responseText. What have I done wrong? Is it because that response encoding-Type is Chunked? If yes, How can I get JSON response back? Edited February 17, 2018 by KeshHERE Link to comment Share on other sites More sharing options...
Danp2 Posted February 17, 2018 Share Posted February 17, 2018 Try commenting out this line -- $login.SetRequestHeader('Accept-Encoding', 'gzip, deflate') Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
KeshHERE Posted February 18, 2018 Author Share Posted February 18, 2018 9 hours ago, Danp2 said: Try commenting out this line -- $login.SetRequestHeader('Accept-Encoding', 'gzip, deflate') Works like a charm.. thanks 😉😉 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now