I’m a proficient developer in C++ and C# but I’m having a hard time getting the spark core to call a http request without having a PC with an api running in the background monitoring the io’s, so I was hoping one of you out there has what it takes to give this NAI a beautiful death…(An answer would do just fine but I couldn’t let the Geeks take all the Glory) I have a webpage like http://telextion.com/LayerServices/111A/auto.html which sends a txt message to my phone from a pin status on the spark core. I just need to initialize the page much the same way a browser would call it. Is there one of you out there with an answer for me? I sure hope so… There’s an earthquake beneath our feet and the world is revolving and somehow I fell off for 10 seconds only to return with my ignorance I once thought was brilliant… Now it’s me needing the right answer…
Are you looking for core firmware to do an HTTP GET request, like a browser does when you load a page? There are a bunch of good ways to do that. If you are looking to do a POST request, like when you click a button on a web page form, that is possible too. The page you referenced is 404 for me, so maybe you need to be logged in to use it.
I would start here:
I've found this library quite simple & useful
Thank you… I’m going through it. Not sure if I have what it takes to get this done because of the elusive code that doesn’t work without tweeking. sometimes it’s easier just to start from scratch. Where do I get the class arguments for the Spark Core? Some of the arguments that I use are not allowed in spark core but are allowed in Arduino…
It looks like someone is working on it because I keep getting hit. if so could somebody please let me know what they are doing. I got a notification from one of the Admins to this site telling me to take down the link because its open to allow people too see my access code to my server. So I encrypted the back end and set up flags to let me know if anyone hits the access page. Thanks to whoever you are for looking into this. I wrote this code to allow the hardware to text message a plurality of people from one action. Let me know whoever you are.
Hi @Anthony,
I don’t think I messaged you earlier, but I just hit your url to test it, and I think I might have sent you an SMS?
I’m not sure what exactly you’re asking, how can we help?
Thanks,
David
Hey Dave,
Well I answered this reply but I guess it didn’t post so I’ll try again. I wanted to call a webpage to send multiple text messages to a plurality of phones that are stored in a database. I’ve written a PHP program out on the web with a CGI that sends the message. Right now that link goes to my phone direct and lately I’ve been sent 18 text messages over the last week or so. I think I’m about to abandon the idea that Spark Core can open a webpage like a browser so I’m now focusing on the POST method action. I’m not too sure what the proper syntax is for posting data to a remote cgi but here is my variables.
<FORM name="myform" ACTION="http://telextion.com/onalertguardian/pm3/cgi/pm.cgi" method=post>
<input type=hidden name=action value=profile_send_email>
<input type=hidden name=tologin value="Anthony">
<table border=0>
<tr>
<td>
<font size=2 face=verdana color=black>
Your Email:
</td>
<td>
<input type=text name=from size=25 value="alert@onalertguardian.com">
</td>
</tr>
<tr>
<td valign=top>
<font size=2 face=verdana color=black>
Message:
</td>
<td>
<textarea name=body wrap=soft cols=60 rows=10>
Attn: %%lastname%%,
Gun shot Detection located at Telos Fitness Center.
13701 Dallas Pkwy, Dallas, TX 75240
Please go to http://telextion.com/onalertguardian/Images/FloorPlan.jpg
For Image of Floor Plan.
Go to Office Board Room next to Cafe
</textarea>
</td>
</tr>
</table>
</form>
So… as you can see I have a sensor that relays the data to a PC which makes the method action post for me by calling the webpage into action. I wrote it in C#. I’ts pretty simple. It uses a COM Port snooper which listens for an event action and auto fires a page if the word “GUNSHOT!” appears in the box. I have to do away with the PC and I was hoping the SPARK CORE could allow me to do just that. Thanks…
Anthony
FORM name=“myform” ACTION=“http://telextion.com/onalertguardian/pm3/cgi/pm.cgi” method=post
input type=hidden name=action value=profile_send_email
input type=hidden name=tologin value="Anthony"
table border=0
tr
td
font size=2 face=verdana color=black
Your Email:
/td
/tr
tr
td valign=top
font size=2 face=verdana color=black
Message:
/td
td
textarea name=body wrap=soft cols=60 rows=10
Attn: %%lastname%%,
Gun shot Detection located at Telos Fitness Center.
13701 Dallas Pkwy, Dallas, TX 75240
Please go to http://telextion.com/onalertguardian/Images/FloorPlan.jpg
For Image of Floor Plan.
Go to Office Board Room next to Cafe
/textarea
/td
/tr
/table
/form
This one without the tags… It didn’t allow me to post table tags in the reply. Sorry about that.
Hi @Anthony,
Just highlight any region of text and click the </>
icon in the text editor, and then you can post whatever code you want.
The easiest way to do what you’re doing is to use Spark.publish, and simply publish an event from your core when something interesting happens:
// e.g.
Spark.publish("Gunshot", "{\"lat\": 123, \"lng\":234}");
And then use something like webhooks to listen for that event from your core, and have it hit a webpage for you (using the spark-cli https://github.com/spark/spark-cli )
spark webhook create Gunshot https://mywebsite.com/myendpoint my_core_id
If you email me at david@spark.io, I’ll give you permissions to create webhooks, since it’s still in limited beta.
Thanks,
David