In http://nodejs.org/docs/v0.4.7/api/http.html#http.request
There is an example that fetches some web content, but how does it save the content to a global variable? It only accesses stuff the function.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If look closely at the example, that HTTP request is used to POST data to a location. In order to GET web content, you should use the method GET.
The HTTP response is available in the on-event function inside the callback-function which is provided as the parameter for the constructor.
Now that we have implemented the event handlers, call request end to send the request.