Connecting to a web page via http

I am trying to get the Spark Core to communicate with my website by sending a GET request to a specific page. So far the closest I got was with this tutorial:

But the sample code does not seem to include anything about reading the response returned by the target page. How should I go about it? Where can I find detailed documentation/examples about how to use the “client” object?

@osprey,

how about considering Webhooks - http://docs.particle.io/core/webhooks/#your-first-webhook-creating-the-webhook

Also, consider trying out the search function on the forums. If you type in “http” you get an abundance of posts concerning this very topic. There’s even an HTTP library, should you be interested.

@kennethlimcp,
I followed the instructions for webhooks here:

http://docs.particle.io/core/cli/#installing

But hit a wall immediately. After installing Node.js, I tried “$ npm install -g particle-cli” as instructed and got this:

SyntaxError: Unexpected identifier
    at Object.exports.createScript (vm.js:44:10)
    at REPLServer.defaultEval (repl.js:117:23)
    at bound (domain.js:254:14)
    at REPLServer.runBound [as eval] (domain.js:267:12)
    at REPLServer.<anonymous> (repl.js:279:12)
    at REPLServer.emit (events.js:107:17)
    at REPLServer.Interface._onLine (readline.js:214:10)
    at REPLServer.Interface._line (readline.js:553:8)
    at REPLServer.Interface._ttyWrite (readline.js:830:14)
    at ReadStream.onkeypress (readline.js:109:10)

Are you on mac or windows? leave out the “$”

Windows 7 Pro

Alright…

Try this: Tutorial: Particle-cli on Windows [07 Jun 2015]

Got stuck when I got to entering “npm install -g particle-cli” in Node.js. It says:

“npm should be run outside of the node repl, in your normal shell.
(Press Control-D to exit.)”

Opps sorry. Can you use the normal Command prompt?

1 Like

OK. Thanks. Didn’t occur to me that I could use the Windows Command Prompt.

1 Like