Your use of words suggests you need to read up on the HTTP request/response process and get a better understanding of what you're trying to do - because you're already doing the same thing you're asking with that code.
Start at the beginning and describe the general problem you're trying to solve / what you're trying to achieve - because if this isn't a learning exercise there's probably already something that does what you want (and it'll be better than that code), but if it is a learning exercise, I'm not just going to hand you a block of code that doesn't help you understand.
EDITED: 20 Dec 2018 14:11 by BOUGHTONP