Most recent activity
-
With options like
var options = { method: 'GET', host: "http://www.upwork.com", path: "/ab/feed/jobs/rss", protocol:"https" };
I'm not setting port. And host also without "http" part. Response look follow:
httpCRs { "headers": { "Date": "Tue, 26 Dec 2017 14:45:42 GMT", "Transfer-Encoding": "chunked", "Connection": "close", "Cache-Control": "max-age=3600", "Expires": "Tue, 26 Dec 2017 15:45:42 GMT", "Location": "https://www.upwork.com/ab/feed/jobs/rss", "X-Content-Type-Options": "nosniff", "Server": "cloudflare-nginx", "CF-RAY": "3d34d34e07fe6409-FRA" }, "httpVersion": "1.1", "statusCode": "301", "statusMessage": "Moved Permanently" } 0 CLOSE
-
Thanks. Just tried. Got response:
<html> <head><title>400 The plain HTTP request was sent to HTTPS port</title></head> <body bgcolor= <html> <head><title>400 The plain HTTP request was sent to HTTPS port</title></head> <body bgcolor="white"> <center><h1>400 Bad Request</h1></center> <center>The plain HTTP request was sent to HTTPS port</center> <hr><center>cloudflare-nginx</center> </body> </html>
Did you get xml in response?
-
-
Hello!
I'm trying to parse xml from url. My code looks like:var wifi = require("Wifi"); function getFeed(){ var options = { method: 'GET', host: "http://www.upwork.com", port: 443, path: "/ab/feed/jobs/rss", protocol:"https" }; var contents = ""; var req = require('http').request(options, function(res) { console.log(res); res.on('data', function(data) { contents += data; console.log(contents); }); res.on('close', function() { console.log('CLOSE'); contents = ""; }); }); req.on('error', function(e) { console.log('Error'); console.log(e); }); req.end(); } wifi.connect("ssid", {password:"pass"}, function(err){ if (err) { console.log("Connection error: "+err); return; } getFeed(); console.log("connected? err=", err, "info=", wifi.getIP()); });
And I got response:
httpCRs { "headers": { "Server": "cloudflare-nginx", "Date": "Mon, 25 Dec 2017 18:01:36 GMT", "Content-Type": "text/html", "Content-Length": "177", "Connection": "close", "CF-RAY": "-" }, "httpVersion": "1.1", "statusCode": "400", "statusMessage": "Bad Request" } <html> <head><title>400 Bad Request</title></head> <body bgcolor="white"> <center><h1>400 Bad Requ <html> <head><title>400 Bad Request</title></head> <body bgcolor="white"> <center><h1>400 Bad Request</h1></center> <hr><center>cloudflare-nginx</center> </body> </html> CLOSE
Seems espruino tries to get host by it's IP, but as I know target site is not accessible by it's IP. Typing url
in browser's address line will return rss feed
So my question is there any workaround for that?
Would appreciate any help
-
I wondering if anyone at all was possible to run espruino on general esp8266 module.
Anyway @Polypod thanks for help! -
@Polypod, I'm using such command:
esptool.py --port /dev/cu.SLAB_USBtoUART --baud 115200 write_flash \ --verify --flash_freq 80m --flash_mode dio --flash_size 4MB \ 0x0000 "boot_v1.6.bin" 0x1000 espruino_esp8266_user1.bin \ 0x3FC000 esp_init_data_default.bin 0x3FE000 blank.bin
This happens with the 3 latests versions
I'm using esp-12e with this adapter
-
-
Got it. Thanks