我似乎無法得到HTTP請求在我的Alexa的技術工作,這裏是有關示例代碼:HTTPS在Alexa的技能要求
var https = require('https');
...
function getTreeFact(callbackFunction){
var url = 'https://alexa.phl.chs.network/treefacts/index.php';
https.get(url, function(res){
var body = '';
res.on('data', function(chunk){
body += chunk;
});
res.on('end', function(){
var gameResponse = JSON.parse(body);
callbackFunction(gameResponse);
});
}).on('error', function(e){
// Handle error
});
}
...
this.getTreeFact(function (responseMessage){
this.emit(':tell', responseMessage.message);
});
我不知道我做錯了,我想我正在提出HTTP請求。我知道這個技能沒有這個功能(只是註釋掉最後三行,並用this.emit(':tell','hello')取代)。
我試圖使用他們的代碼,但它仍然給我同樣的錯誤。我認爲這是我正在訪問的網站,但只是使用google.com也無法正常工作... 我只是希望它實際上會顯示錯誤消息 –
我嘗試訪問我的瀏覽器上的代碼中的網站,但它似乎它已關閉,試圖google.com將無法正常工作,因爲它不吐出JSON。嘗試使用[此鏈接]進行測試(http://ip.jsontest.com) –