# Calling a http request to open webpage

**URL:** <https://community.particle.io/t/calling-a-http-request-to-open-webpage/4377>\
**Category:** Cloud\
**Created:** [May 15, 2014, 10:13pm UTC](https://community.particle.io/t/calling-a-http-request-to-open-webpage/4377 "2014-05-15T22:13:00Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anthony](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@Anthony](https://community.particle.io/u/Anthony)\
**Post date:** [May 15, 2014, 10:13pm UTC](https://community.particle.io/t/calling-a-http-request-to-open-webpage/4377/1 "2014-05-15T22:13:00Z")

</div>

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](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…

---

<div class="post-metadata">

**Author:** ![bko](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bko/32/20704_2.png) [@bko](https://community.particle.io/u/bko)\
**Post date:** [May 15, 2014, 11:43pm UTC](https://community.particle.io/t/calling-a-http-request-to-open-webpage/4377/2 "2014-05-15T23:43:21Z")

</div>

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:

> **[nmattisson/HttpClient](https://github.com/nmattisson/HttpClient)**
>
> HttpClient - Http Client Library for the Spark Core (also well suited for Arduino and other embedded platforms).

---

<div class="post-metadata">

**Author:** ![dermotos](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/dermotos/32/3556_2.png) [@dermotos](https://community.particle.io/u/dermotos)\
**Post date:** [May 16, 2014, 12:03am UTC](https://community.particle.io/t/calling-a-http-request-to-open-webpage/4377/3 "2014-05-16T00:03:55Z")

</div>

I've found this library quite simple & useful

> **[REST Client Library for Spark](https://community.particle.io/t/rest-client-library-for-spark/4114)**
>
> I’ve been working on a project that requires multiple REST calls and unfortunately didn’t see the work going on here: https://community.spark.io/t/spark-core-http-client-library/3251 So I ported the simple RestClient for Arduino library to work...

---

<div class="post-metadata">

**Author:** ![Anthony](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@Anthony](https://community.particle.io/u/Anthony)\
**Post date:** [May 18, 2014, 10:08pm UTC](https://community.particle.io/t/calling-a-http-request-to-open-webpage/4377/4 "2014-05-18T22:08:10Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![Anthony](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@Anthony](https://community.particle.io/u/Anthony)\
**Post date:** [July 9, 2014, 8:15pm UTC](https://community.particle.io/t/calling-a-http-request-to-open-webpage/4377/5 "2014-07-09T20:15:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Dave](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/dave/32/181_2.png) [@Dave](https://community.particle.io/u/Dave)\
**Post date:** [July 9, 2014, 9:34pm UTC](https://community.particle.io/t/calling-a-http-request-to-open-webpage/4377/6 "2014-07-09T21:34:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Anthony](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@Anthony](https://community.particle.io/u/Anthony)\
**Post date:** [July 15, 2014, 2:00pm UTC](https://community.particle.io/t/calling-a-http-request-to-open-webpage/4377/7 "2014-07-15T14:00:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Anthony](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@Anthony](https://community.particle.io/u/Anthony)\
**Post date:** [July 15, 2014, 2:02pm UTC](https://community.particle.io/t/calling-a-http-request-to-open-webpage/4377/8 "2014-07-15T14:02:53Z")

</div>

FORM name=“myform” ACTION=“[http://telextion.com/onalertguardian/pm3/cgi/pm.cgi](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.

---

<div class="post-metadata">

**Author:** ![Dave](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/dave/32/181_2.png) [@Dave](https://community.particle.io/u/Dave)\
**Post date:** [July 15, 2014, 2:49pm UTC](https://community.particle.io/t/calling-a-http-request-to-open-webpage/4377/9 "2014-07-15T14:49:17Z")

</div>

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:

```auto
// 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](https://github.com/spark/spark-cli) )

```auto
spark webhook create Gunshot https://mywebsite.com/myendpoint my_core_id

```

If you email me at [david@spark.io](mailto:david@spark.io), I’ll give you permissions to create webhooks, since it’s still in limited beta. 🙂

Thanks,  
David
