Please see my last comment to the question, about HTTP response and HTTP request. You can do it directly using the class
It might help you to understand what's going on, but I doubt it immediately help you to solve your problem. I suspect that your problem is based on misunderstanding of how Web words, so you cannot even explain the problem. Learn about it some more; this is the best way to help yourself.