Hi Richard,

Thank for this fast response !

I saw that I forgot the

> req.end();

at the end of my request to really send the request to the server, now it's
working !!
 I'll also try this request module, thank you for this link!

you know this module too ?
https://github.com/automatthew/shred

2012/10/31 Richard Rodger <[email protected]>

> Hi Ismael,
>
> Your best bet is to use mikael's request module which has an easy-to-use
> API:
>
> https://github.com/mikeal/request
>
> Also, have you validated that the server is working as expected using curl
> etc.
>
> Richard
>
> Sent from my iPhone
>
> On 31 Oct 2012, at 10:39, Ismael Gorissen <[email protected]>
> wrote:
>
> Hi,
>
> I want to execute some codes every hour, so I used a module for nodejs
> called CRON, it works perfectly ! But now I'm facing an issue. I need to
> make a HTTP request to a server with only an url, and this server must
> respond with a json object (because json is define in the url). But when
> I'm doing this
>
> var options = {
>>
>>         host: "domain.com",
>>
>>         path: "/path/json"
>>
>>     };
>>
>>
>>>     http.request(options, function(res)
>>
>>     {
>>
>>         var data = '';
>>
>>
>>>         res.setEncoding('utf8');
>>
>>         res.on('data', function(chunk)
>>
>>         {
>>
>>             data += chunk;
>>
>>         });
>>
>>         res.on('end', function()
>>
>>         {
>>
>>             console.log(data);
>>
>>         });
>>
>>     }).on('error', function(err)
>>
>>     {
>>
>>         console.log(err.message);
>>
>>     });
>>
>>
> I always receive this message
>
> <HTML><HEAD>
>
> <TITLE>Request Timeout</TITLE>
>
> </HEAD><BODY>
>
> <H1>Request Timeout</H1>
>
> The server timed out while waiting for the browser's request.<P>
>
> Reference&#32;&#35;2&#46;8a643e17&#46;1351678745&#46;0
>
> </BODY></HTML>
>
>
>
> any idea ? I only want to make a request, I don't need to create a server,
> just launch the script using cronjob and launching my request each hour.
>
> Thank you !!
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
>  --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>



-- 
Ismael Gorissen
+32 (0) 486 530 613

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to