javascript - NodeJS request works local, not on VPS -
in nodejs project, send request
html of webpage. works fine when run code on macbook, request times out when run same code on vps. don't know lot servers, have no thought look.
this request
send:
request({ uri: 'http://torrentz.eu/search?f=' + encodeuricomponent(data.query) , headers: { 'user-agent': 'mozilla/5.0 (macintosh; intel mac os x 10_6_8) applewebkit/537.13+ (khtml, gecko) version/5.1.7 safari/534.57.2', } }, console.dir);
error:
{ [error: connect etimedout] code: 'etimedout', errno: 'etimedout', syscall: 'connect' }
edit:
other request
s (like 1 below) work fine.
request({ uri: 'http://api.trakt.tv/account/test/' + config.trakt.apikey , method: 'post' , form: { username: data.username , password: data.password } }, function( err, resp, info ) { if( data.status === 'success' ) { user.set({ trakt_username: data.username , trakt_password: data.password }).then(defer.resolve).catch(defer.reject); } else { defer.reject( data.error ); } });
javascript node.js vps
No comments:
Post a Comment