# Make a curl with post or oder

**URL:** <https://discourse.nodered.org/t/make-a-curl-with-post-or-oder/48495>\
**Category:** Developing Nodes\
**Created:** [16 July 2021 14:17 UTC](https://discourse.nodered.org/t/make-a-curl-with-post-or-oder/48495 "2021-07-16T14:17:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![amin233](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/amin233/32/45043_2.png) [@amin233](https://discourse.nodered.org/u/amin233)\
**Post date:** [16 July 2021 14:17 UTC](https://discourse.nodered.org/t/make-a-curl-with-post-or-oder/48495/1 "2021-07-16T14:17:47Z")

</div>

Hello  
This is a command from gsm modem to send SMS.  
How can I run the following command in node red? And of course send the phone number and text of the SMS out of the variable?  
thank you

curl '[http://192.168.8.1/api/sms/send-sms](http://192.168.8.1/api/sms/send-sms)'   
-H 'Connection: keep-alive'   
-H 'Pragma: no-cache'   
-H 'Cache-Control: no-cache'   
-H 'Accept: _/_'   
-H 'X-Requested-With: XMLHttpRequest'   
-H '\_\_RequestVerificationToken: 1743643931'   
-H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'   
-H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8'   
-H 'Origin: 192.168.8.1'   
-H 'Referer: 192.168.8.1/html/smsinbox.html'   
-H 'Accept-Language: fa-US,fa;q=0.9,en-US;q=0.8,en;q=0.7'   
-H 'dnt: 1'   
--data-raw '\<?xml version="1.0" encoding="UTF-8"?\>-1+239133311838text message sms1512021-07-16 18:19:51'   
--compressed   
--insecure

---

<div class="post-metadata">

**Author:** ![greengolfer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/greengolfer/32/28276_2.png) [@greengolfer](https://discourse.nodered.org/u/greengolfer)\
**Post date:** [16 July 2021 16:53 UTC](https://discourse.nodered.org/t/make-a-curl-with-post-or-oder/48495/2 "2021-07-16T16:53:23Z")

</div>

Have you looked at the (very good) documentation of the `http request` node?  
Doing what you want is fairly obvious once you have looked at the manual.

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [16 July 2021 20:04 UTC](https://discourse.nodered.org/t/make-a-curl-with-post-or-oder/48495/3 "2021-07-16T20:04:24Z")

</div>

Also are you 100% sure all that is required, I'll bet most of the headers aren't especially

> -H 'Connection: keep-alive'  
> -H 'Pragma: no-cache'  
> -H 'Cache-Control: no-cache'  
> -H 'X-Requested-With: XMLHttpRequest'  
> -H 'Accept-Language: fa-US,fa;q=0.9,en-US;q=0.8,en;q=0.7'

---

<div class="post-metadata">

**Author:** ![amin233](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/amin233/32/45043_2.png) [@amin233](https://discourse.nodered.org/u/amin233)\
**Post date:** [17 July 2021 05:51 UTC](https://discourse.nodered.org/t/make-a-curl-with-post-or-oder/48495/4 "2021-07-17T05:51:27Z")

</div>

Unfortunately I'm not a programmer and I use node red for my simple tasks, I also extracted these commands from the Google Chrome output.  
Please give me a sample flow to run the above program if possible. Thank you

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [17 July 2021 06:32 UTC](https://discourse.nodered.org/t/make-a-curl-with-post-or-oder/48495/5 "2021-07-17T06:32:38Z")

</div>

Please read the doc that @greengolfer pointed at and try, if you get stuck post whay you've tried and we'll help you fix it.

[https://cookbook.nodered.org/#http-requests](https://cookbook.nodered.org/#http-requests)

---

<div class="post-metadata">

**Author:** ![greengolfer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/greengolfer/32/28276_2.png) [@greengolfer](https://discourse.nodered.org/u/greengolfer)\
**Post date:** [17 July 2021 07:50 UTC](https://discourse.nodered.org/t/make-a-curl-with-post-or-oder/48495/6 "2021-07-17T07:50:47Z")

</div>

It is customary on this kind of forum to try first and then ask for help and not saying _please, can you do this for me_...

Using the documentation, you can figure out that you have to put the url in _msg.url_, the headers in _msg.headers_ and so on. Either with a change node or a function node something like:

```auto
msg.url = "http://192.168.8.1/api/sms/send-sms";
msg.method = "GET";
msg.headers = {
    'Origin': '192.168.8.1'
    'Referer': '192.168.8.1/html/smsinbox.html'
} ;

```

And so on.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [15 September 2021 07:51 UTC](https://discourse.nodered.org/t/make-a-curl-with-post-or-oder/48495/7 "2021-09-15T07:51:41Z")

</div>

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