There is something wrong with the request I'm making and I can't figure it out. It seems everything is in order according to the API spec.
Here is the code:
var request = require('https').request;
var opts = {
host: 'intersango.com',
method: 'GET',
path: '/api/ticker.php',
port: 443,
accept: '*/*',
headers: { 'User-Agent': 'Mozilla/5.0 (X11; Linux i686; rv:10.0) Gecko/20100101 Firefox/10.0' } };
var req = request(opts, function (result) {
result.setEncoding('utf8');
var buffer = '';
result.on('data', function(data) {
buffer += data;
});
result.on('end', function() {
console.log('<- Received ' + buffer.length + ' bytes');
var data = JSON.parse(buffer);
console.log(data);
});
});
req.on('error', function(e) {
console.log('warning: problem with request: ' + e.message);
});
console.log('-> ' + opts['method'] + ' ' + opts['host'] + ':' + opts['port'] + opts['path']);
req.end();
Here is the output:
$> node test.intersango.js
-> GET intersango.com:443/api/ticker.php
warning: problem with request: socket hang up
Interestingly, if you go to https://intersango.com/api/ticker.php in your browser its fine, but not if you just go to intersango.com:443/api/ticker.php. I tried some other ports but it just gives warning: problem with request: connect ECONNREFUSED
Note: trying POST doesnt help either
Just to confirm, downgrading Node did solve the issue.