SORU
13 NİSAN 2011, ÇARŞAMBA


Ne kadar uzak DİNLENME node.js içinde arama yapmak için? herhangi bir CURL?

Node.jsçocuk işlem yapmak için kullanmaktan başkaCURLarama, CURL uzak sunucu için arama yapmak için bir yoldurDİNLENMEVe dönüş veri API mı?

Ben de istek uzaktan bağlantı kurmak gerekirDİNLENMEve sorgu dize gel de (veya SONRASI).

Bu bir tane buldum: http://blog.nodejitsu.com/jsdom-jquery-in-5-lines-on-nodejs

ama sorgu dizesi göndermek için herhangi bir yol göstermiyor.

CEVAP
13 NİSAN 2011, ÇARŞAMBA


http.request bak

var options = {
  host: url,
  port: 80,
  path: '/resource?id=foo&bar=baz',
  method: 'POST'
};

http.request(options, function(res) {
  console.log('STATUS: '   res.statusCode);
  console.log('HEADERS: '   JSON.stringify(res.headers));
  res.setEncoding('utf8');
  res.on('data', function (chunk) {
    console.log('BODY: '   chunk);
  });
}).end();

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • DominicFear

    DominicFear

    30 Kasım 2006
  • Munchkin the Teddy Bear

    Munchkin the

    30 EYLÜL 2011
  • SDSARG3

    SDSARG3

    14 Mart 2009