# How to get http/https server respons?

Hi I'm new to this.

I'm trying to get http/https respons, which tells sensor data.

Is there a sample project or code reference for me to get a basic understanding of how to write my own blocks?

Any link is well appreciated.

The basic URL block from the sensing category can fetch data from an endpoint

Note - to access an local LAN http server, don't run your script from the standard https site - run it from

http://extensions.snap.berkeley.edu/snap/snap.html


Snap! handbook is here on how to write custom blocks

Please move this: #help

Done.

Well, it seems quite different from SnapManual. What I have missed?

No single line of strings.

--
Sorry, I can't embed image in reply

That's because of CORS. It looks like you can't get the snap homepage from Snap! Build Your Own Blocks which is weird. Only the snap devs can fix this.

I don't know why the standard one doesn't work but the one in the Web services library seem to still be OK

Yes, this works.

a) Sorry, what do u mean "That's because of CORS". I'm new here Not sure about what's CORS?

b) I also tried Snap4Arduino installed on my computer.

Still the same.

Hope some can help me out of this

I don't know how to explain it, but here's what CORS is

If you're making requests to localhost, then you don't have to worry about this (unless you're using brave).

If you search CORS on this forum, you'll see we've had to deal with it a lot. To get around it, use a CORS proxy.

So basically, websites don’t really like it when you try and get their content. So you use a cors proxy! My favorite is allorigins.win, which has use instructions on its site.

Thanks, it helps a lot.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.